开发者

prevent duplicate saving of data by double click simultaneously

开发者 https://www.devze.com 2023-03-07 01:45 出处:网络
i am ad开发者_C百科ding some data in gridand clicking save button twice simultaneously,then it adding same data twice.

i am ad开发者_C百科ding some data in grid and clicking save button twice simultaneously,then it adding same data twice. How to prevent saving same data twice or multiple time.


Assuming that you're dealing with a problem which only occurs while the save is occurring then how about disabling the button when it is clicked. That would prevent any further click events until the save processing has finished, ensuring your save event is only called once. You'd need to control the enable/disable of the save button as the button is shown and hidden on your display.

If that doesn't help then it would be best if you could edit you question to include the code, so we can see what you're trying to do.


I came up with a workaround. It also works for showing to the user, in a subtle way, that the saving process has completed.

First I disabled the button at the beginning of click event, then I placed a defer function with 800 milliseconds delay, where I wanted the button to be enabled again.

Ext.defer(function () {
            btn.enable();
        }, 800);
0

精彩评论

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