0
votes

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.

1
Shouldn't autoCancel set to false (as done in your code) already provide that functionality? It seems to work in the Row Editing examplematt
@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
Add the way tGrid has been configured.vdshb

1 Answers

0
votes

//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) {  
                  .....  
                }  
}