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);
精彩评论