0

I use ExtJS 4.2.2 version.

I create RowEditing

rowEditing = Ext.create('Ext.grid.plugin.RowEditing', {
        clicksToEdit : 2,
        clicksToMoveEditor : 1,
        autoCancel : false,
        errorSummary : false,
        listeners : {
            edit : function(editor, e, opt) {
                // ... some code ...
            }
        }
});

and then use it on panel:

tGrid = Ext.create('Ext.tree.Panel', {
    title : 'title',
    rootVisible : false,
    store : tStore,
    plugins : [ rowEditing ],
    columns : this.defineColumns()
});

this.defineColumns = function() {
    return [ {
        text : 'smth',
        xtype : 'treecolumn',
        dataIndex : 'name',
        width : 300,
        editor : {}
    }];
};

So when i change some data with using of rowEditing and then change row, all my changes drops. I want to refuse changing position of row under edit, without permission. Or at least auto save changes of data with row change. Can't find a way to do it.

vdshb
  • 1,949
  • 2
  • 28
  • 40
  • 2
    Shouldn't [autoCancel](http://docs-origin.sencha.com/extjs/4.2.2/#!/api/Ext.grid.plugin.RowEditing-cfg-autoCancel) set to `false` (as done in your code) already provide that functionality? It seems to work in the [Row Editing example](http://docs.sencha.com/extjs/4.2.2/extjs-build/examples/grid/row-editing.html?theme=classic) – matt Nov 19 '13 at 16:09
  • @matt, I wish autoCancel works. But it doesn't. May be it's because I use Ext.tree.Panel, instead of Ext.greed.Panel. I'll add more information about tGrid configureing. – vdshb Nov 20 '13 at 05:48
  • Add the way tGrid has been configured. – vdshb Nov 20 '13 at 06:24

1 Answers1

0

//Configure onGridCellClick on your controller to auto save modified rows

init: function() {    
        this.control({    
        '#listingGrid' : {   
            cellclick : this.onGridCellClick  
        }  
    });  
}  

onGridCellClick: function() {  
// Autosave modified rows.  
var lModifiedRecords = YourApp.utils.CustomUtils.getGrid().getStore().getModifiedRecords();  
for (var i=0; i< lModifiedRecords.length; i++) {  
 var lModifiedRecord = lModifiedRecords[i].data;  
 var ajaxConfig = {url: '#{serviceUrl}', requestParams: lModifiedRecord};  
 ajaxWrapper(ajaxConfig);  
}

function ajaxWrapper(ajaxConfig) {  
  Ext.Ajax.request({  
        scope   : this,  
        url     : ajaxConfig.url,  
        ..  
        params  : ajaxConfig.requestParams,   
        success : function(response, opts) {  
                  .....  
                }  
}
Vinny
  • 15
  • 1
  • 6