PDA

View Full Version : RowEditor: ed.setWidth is not a function



verraf76
30 Jun 2010, 1:54 AM
Hi,
I'm using ExtJs 3.2.1 and the RowEditor extension but I've the error: "ed.setWidth is not a function".

I've follow the suggest in

http://www.sencha.com/forum/showthread.php?101069-UX-RowEditor-ed.setWidth-is-not-a-function
http://www.sencha.com/forum/showthread.php?91896-RowEditor-error-ed.setWidth-is-not-a-function

but nothing...
any idea?
Anyone can help me?

tnx

mankz
30 Jun 2010, 9:52 PM
Post your code please.

verraf76
1 Jul 2010, 9:07 AM
Resolved...maybe....
The problem was a date type column...with some value like Jan 7, 2010 00:00:00, I have the error...
I resolved using the format 07.01.2010
Tnx

twisted_pear
20 Aug 2010, 9:45 AM
I'm hitting the same problem. Locally I've adapted the RowEditor example and it runs fine, but when integrated into my application's GridPanel constructor I get: ed.setWidth is not a function @ RowEditor.js line 275

When debugging, the first column is just fine (checkBoxes) and it's Editor property has a .setWidth() method, however every other column has no .setWidth() method.

Is there some reason a column would not have this method?

Note: I've tried the following


Using 3.1.1 build always had this problem (RowEditor example and below code). Upgraded to 3.2.1 and example runs, but other code still does not.
Tried commenting out columns. Only if all columns are removed, OR no columns have an editor property set does the problem not occur. Since you need editors for this example and columns, this does not help.



// Grid object to show account information
ClientAccountGrid = Ext.extend(Ext.grid.GridPanel,
{

...

// Inline Row editor for below Account grid
// NOTE: requires /ux/RowEditor.js to entend Ext.Panel
plugins : new Ext.ux.grid.RowEditor({
saveText: 'Update'
}),

constructor : function (config) {

...

config = Ext.apply({
bbar : pagingBBar,
//Following two lines allow the browser to set the dimensions
autoHeight : true,
autoWidth : true,
stripeRows : true,
selModel : accountGridCheckBoxes,
tooltip : 'Accounts belonging to this client',
colModel : new Ext.grid.ColumnModel({
defaults: {sortable: true, filterable: true},
// Each dataIndex must match up with a field in the store.
columns : [
// Note editor objects to determine how columns will be edited in place in the rows
accountGridCheckBoxes, // A column of checkboxes
{
dataIndex: 'account.accountName',
header: 'Account Name',
sortable: true,
width : 200,
editor: {
xtype:'textfield',
disabled:true
}
},
{
dataIndex: 'account.accountId',
header: 'Account ID',
sortable: true,
width : 65,
editor: {
xtype:'numberfield',
disabled:true
}
},
{
dataIndex: 'validFromDate',
header: 'Valid From',
sortable: true,
width : 65,
xtype: 'datecolumn',
format: 'd/m/Y',
editor: {
xtype:'datefield',
allowBlank:false,
disabled:false
}
},
{
dataIndex: 'validToDate',
header: 'Valid To',
sortable: true,
width : 65,
xtype: 'datecolumn',
format: 'd/m/Y',
editor: {
xtype:'datefield',
allowBlank:false,
disabled:false
}
},
{
dataIndex: 'account.address1',
header: 'Address 1',
sortable: true,
width : 200,
editor: {
xtype:'textfield',
disabled:true
}
},
{
dataIndex: 'account.city',
header: 'City',
sortable: true,
width: 80,
editor: {
xtype:'textfield',
disabled:true
}
},
{
dataIndex: 'account.state',
header: 'State',
sortable: true,
width : 35,
editor: {
xtype:'textfield',
disabled:true
}
}
]
})
}, config);
this.addEvents(['findaccounts','deleteaccounts']);

// draw grid
ClientAccountGrid.superclass.constructor.call(this, config);
}
});

twisted_pear
20 Aug 2010, 1:11 PM
I'm not sure which caused the issue, but RowEditor.js must be loaded before any other /ux/ extension.

Previously RowEditor.js was at the bottom of this list, now at the top it works well.


<!-- Extended ExtJS objects from Examples Libraries -->
<script src="<s:url value='/js/extjs/examples/ux/RowEditor.js'/>"></script>
<script src="<s:url value='/js/extjs/examples/ux/gridfilters/GridFilters.js'/>"></script>
<script src="<s:url value='/js/extjs/examples/ux/gridfilters/filter/Filter.js'/>"></script>
<script src="<s:url value='/js/extjs/examples/ux/gridfilters/menu/ListMenu.js'/>"></script>
<script src="<s:url value='/js/extjs/examples/ux/gridfilters/menu/RangeMenu.js'/>"></script>
<script src="<s:url value='/js/extjs/examples/ux/gridfilters/filter/DateFilter.js'/>"></script>
<script src="<s:url value='/js/extjs/examples/ux/gridfilters/filter/ListFilter.js'/>"></script>
<script src="<s:url value='/js/extjs/examples/ux/gridfilters/filter/NumericFilter.js'/>"></script>
<script src="<s:url value='/js/extjs/examples/ux/gridfilters/filter/StringFilter.js'/>"></script>

It would be nice to know which of these was the culprit.