PDA

View Full Version : Checkbox missing in row editor while choosing Ext.selection.CheckboxModel for grid



ray.lou
15 Nov 2011, 5:40 AM
Here is my problem and screenshot:
My checkbox is missing on my row editor when I choosing Ext.selection.CheckboxModel for the grid.
29294

After debugging the code, I found in old extjs version: 4.0.2a, the add method of "Ext.util.HashMap" is:



/**
* Adds an item to the collection. Fires the {@link #add} event when complete.
* @param {String} key <p>The key to associate with the item, or the new item.</p>
* <p>If a {@link #getKey} implementation was specified for this HashMap,
* or if the key of the stored items is in a property called <tt><b>id</b></tt>,
* the HashMap will be able to <i>derive</i> the key for the new item.
* In this case just pass the new item in this parameter.</p>
* @param {Object} o The item to add.
* @return {Object} The item added.
*/
add: function(key, value) {
var me = this,
data;


if (arguments.length === 1) {
value = key;
key = me.getKey(value);
}


if (me.containsKey(key)) {
me.replace(key, value);
}


data = me.getData(key, value);
key = data[0];
value = data[1];
me.map[key] = value;
++me.length;
me.fireEvent('add', me, key, value);
return value;
},



Where the checkbox in row editor got deleted from 'me.replace(key, value);' but added back on the fired event 'add' since it doesn't return after 'me.replace(key, value);'


In new extjs version: 4.0.7, the add method of "Ext.util.HashMap" is:





/**
* Adds an item to the collection. Fires the {@link #add} event when complete.
* @param {String} key <p>The key to associate with the item, or the new item.</p>
* <p>If a {@link #getKey} implementation was specified for this HashMap,
* or if the key of the stored items is in a property called <tt><b>id</b></tt>,
* the HashMap will be able to <i>derive</i> the key for the new item.
* In this case just pass the new item in this parameter.</p>
* @param {Object} o The item to add.
* @return {Object} The item added.
*/
add: function(key, value) {
var me = this,
data;


if (arguments.length === 1) {
value = key;
key = me.getKey(value);
}


if (me.containsKey(key)) {
return me.replace(key, value);
}


data = me.getData(key, value);
key = data[0];
value = data[1];
me.map[key] = value;
++me.length;
me.fireEvent('add', me, key, value);
return value;
},



Where the checkbox in row editor got deleted from 'me.replace(key, value);' but never added back by since it returned directly.
This is why checkbox doesn't show up and screwed the row editor align.
And my current walk around is to override the initEditor when I create Ext.grid.plugin.RowEditing:


initEditor: function() {
var me = this,
grid = me.grid,
view = me.view,
headerCt = grid.headerCt;

return Ext.create('Ext.grid.RowEditor', {
onFieldReplace: function(map, fieldId, column, oldColumn) {
var me = this;
//me.onFieldRemove(map, fieldId, oldColumn);
},
autoCancel: me.autoCancel,
errorSummary: me.errorSummary,
fields: headerCt.getGridColumns(),
hidden: true,

// keep a reference..
editingPlugin: me,
renderTo: view.el
});
},

Is there anyone else who met this issue? Or I'm just so lucky.

mitchellsimoens
16 Nov 2011, 1:00 PM
There is an open bug report for the checkbox selection model and action column in regards to the row editor.