开发者

Ext RowEditor.js does not fire 'afteredit' event

I have a Ext grid with RowEditor plugin. I have the following code to add 'afteredit' event to the roweditor object.

store.on('update',function(){
    });

    editor.on("afteredit",function(roweditor,changes,record,index){

        $.ajax({
            url: $("#web").val() + "/registration/client/address-save"
            ,type: 'post'
            ,data: record.json
            ,dataType: 'json'
            ,success: function(data){
                if(data.success == true){
                    alert("Update Successfully");
                }
            }
        });
    });

when I click a row and edit a value, sometimes the grid fires 'aftere开发者_开发百科dit' event, but sometimes it doesn't.

Do I have a problem with my code above?


Ext.grid.EditorGridPanel.prototype.onEditComplete = function(e, value, startValue){ alert('asd') }


I have also experienced the above same problem in my ExtJS code. After spending quite some time debugging my application, I realised that the problem was not coming from my code but from the RowEditor plugin itself.

The plugin worked by creating a reference to the record the user wanted to update, and after the user clicked the Update button it would compare the new and old values, and if any value was different it would execute an update. The problem was that sometimes the record would get it's values updated before this comparison is executed, thus resulting in the comparison not finding any different values and exit the function.

I edited the code of the RowEditor.js file so that instead of making comparisons with the actual record, I create a clone of the record and compare the new values with its values. Since it's a clone, its values never change and the problem is eliminated. The updated code can be found here:

http://www.mediafire.com/?l0h8efhvc9wb2fp


I believe this issue got resolved, when I tried it today, it is working fine, as expected.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜