PDA

View Full Version : which plugin to be use for row editing



bee
31 Oct 2011, 9:20 PM
This question could be very silly and stupid, but I am bit confused why we have two files for row editing ext.grid.plugin.RowEditing and ux.grid.RowEditor.js.

Which one should be used as plugin so that I can use in my application. my commit is not working while updating. I am using extjs 4.0.7 and even tried 4.1pr

flanders
1 Nov 2011, 12:57 AM
The roweditor was an user extension before (the ux variant) for extjs 3. Now in extjs4 it's part of the framework itself.

So, you should use this version under extjs4

bee
1 Nov 2011, 1:18 AM
The roweditor was an user extension before (the ux variant) for extjs 3. Now in extjs4 it's part of the framework itself.

So, you should use this version under extjs4

You meant to say that I should use RowEditor instead of RowEditing ?

flanders
1 Nov 2011, 2:03 AM
I should have been a bit more explicit ;)

Yes, the one to use is Ext.grid.plugin.RowEditing

bee
1 Nov 2011, 3:29 AM
I should have been a bit more explicit ;)

Yes, the one to use is Ext.grid.plugin.RowEditing

why record.commit() diesn't work on it? Any work around for this ?

flanders
1 Nov 2011, 3:53 AM
Without your code I have no clue ;) But I would guess that you shouldn't use the commit() function but instead sync() the store.

This is what i used to do back in the day


this.editor.on('afteredit', function(editor, changes, record, rowIndex) {
if (changes.passwordHash) {
record.set('passwordHash', base.SHA1(changes.passwordHash));
}
this.store.save();
this.store.reload();
}, this);

this.editor.on('canceledit', function(editor, forced) {
if (this.store.getAt(0).phantom) {
this.store.remove(this.store.getAt(0));
}
}, this);

bee
1 Nov 2011, 7:09 AM
Ext.getCmp('bEditor').on('afteredit', function(editor, changes, record, rowIndex) {
console.log('@@@@@@');
editor.store.save();
console.log('[email protected]');
editor.store.reload();
console.log('[email protected]');
});
I am getting error as Uncaught TypeError: Cannot call method 'save' of undefined

bee
1 Nov 2011, 7:13 AM
Uncaught TypeError: Cannot call method 'save' of undefined

(anonymous function)

fireext-all-debug.js:10658 (http://localhost:8080/i/lib/ext-4.0.7-gpl/ext-all-debug.js)
Ext.define.continueFireEventext-all-debug.js:13854 (http://localhost:8080/i/lib/ext-4.0.7-gpl/ext-all-debug.js)
Ext.define.fireEventext-all-debug.js:13834 (http://localhost:8080/i/lib/ext-4.0.7-gpl/ext-all-debug.js)
(anonymous function)ext-all-debug.js:14039 (http://localhost:8080/i/lib/ext-4.0.7-gpl/ext-all-debug.js)
fireext-all-debug.js:10658 (http://localhost:8080/i/lib/ext-4.0.7-gpl/ext-all-debug.js)
Ext.define.continueFireEventext-all-debug.js:13854 (http://localhost:8080/i/lib/ext-4.0.7-gpl/ext-all-debug.js)
Ext.define.fireEventext-all-debug.js:13834 (http://localhost:8080/i/lib/ext-4.0.7-gpl/ext-all-debug.js)
Ext.define.completeEditRowEditing.js:172 (http://localhost:8080/i/lib/plugins/RowEditing.js)
Ext.define.fireHandlerext-all-debug.js:29512 (http://localhost:8080/i/lib/ext-4.0.7-gpl/ext-all-debug.js)
Ext.define.onClickext-all-debug.js:29502 (http://localhost:8080/i/lib/ext-4.0.7-gpl/ext-all-debug.js)
(anonymous function)
wrap


below is the line no 172 in rowediting.js
// private
completeEdit: function() {
var me = this;


if (me.editing && me.validateEdit()) {
me.editing = false;
me.fireEvent('edit', me, me.context);
}
},

flanders
1 Nov 2011, 7:41 AM
The parameters that are passed to the eventhandler are changed with regards to what i posted. The code i posted is quite old.

You should put in a console.log(arguments) to explore the arguments and see how you can obtain the correct references. (People note in the docs that the document possibly isn't correct either here)

something like

....on('edit', function(editor) {
editor.store.sync();
});

if I read the docs/comments right

bee
3 Nov 2011, 1:37 AM
The parameters that are passed to the eventhandler are changed with regards to what i posted. The code i posted is quite old.

You should put in a console.log(arguments) to explore the arguments and see how you can obtain the correct references. (People note in the docs that the document possibly isn't correct either here)

something like

....on('edit', function(editor) {
editor.store.sync();
});

if I read the docs/comments right

Thanks. I fixed my problem using code as below :
Editor.on('afteredit', function(editor, changes, record, rowIndex) {
editor.store.sync();
GridStore.load();
});