PDA

View Full Version : How to prevent record changing in grid



evgenspb
5 Aug 2010, 8:59 AM
Hello guys

I have form and grid.
They are linked.
User can change record in the form by the grid.
It is possible to modify record in the form.
I want fire confirmation (Do you really want to lost data?) if user modify current record, but tries to change record by grid without saving (or canceling).
If user select NO (do not want lost data) I need to prevent record changing.

Any Ideas?

Evgeny

darthwes
5 Aug 2010, 9:03 AM
So you have a listener for the grid's selection model's row select event and you populate the form when the selection changes with the current row's data?

Condor
6 Aug 2010, 12:54 AM
Write a beforerowselect event handler (since Ext.MsgBox.confirm is asynchronous you need to write some additional code (http://www.sencha.com/forum/showthread.php?56946-MessageBox.confirm-doesnt-stop-in-some-cases&p=271923#post271923)).

evgenspb
10 Aug 2010, 10:48 PM
Guys, sorry for long delay.
I worked in offline zone last days.
Condor, I have found the same way as you offered.
Thanks you a lot, I am sure that I am on right way now.

BTW
I guess asynchronous confirm (or alert) is a some problem for guys who worked with C++, VB or another nonWEB system early.

Best regards
Evgeny

P.S.
Sorry for my English, I did not have any practices several years .

evgenspb
10 Aug 2010, 11:47 PM
Thank you a lot :)