1. #1
    Sencha User
    Join Date
    Dec 2007
    Posts
    69
    Vote Rating
    0
    cblin is on a distinguished road

      0  

    Default How to implement "Do not leave the form under editing"

    How to implement "Do not leave the form under editing"


    At the moment, I am trying to implement a feature request that says "if a form is edited, the user must not be able to leave the form without a warning message if he did not use one of the 2 buttons (save or cancel)"

    The warning message is something like "Are you sure to leave the current form without saving modifications ?" -> yes/no

    If the user says yes (he is sure to lose his modifications), we must continue the screen workflow otherwise we must stay on the current screen.

    The conclusion I made from my current investigations is that ExtJs provide no way to help me because there is no beforelostfocus event on the Panel

    So, for a tabpanel, I have to be aware of beforetabchange so that if the user says yes I must manually activate the panel that was going to be activated

    So, for a gridpanel, I have to be aware of selModel.beforerowselect or beforecellselect

    So basically my current solution is to implement a plugin with a singleton that knows which component is edited and so I can make my best to return false on the given events.

    Is there a better way ?

  2. #2
    Sencha User laurentParis's Avatar
    Join Date
    Aug 2010
    Location
    paris
    Posts
    246
    Vote Rating
    2
    laurentParis is on a distinguished road

      0  

    Default


    Every links on menus, buttons... pass by same method with argument : url

    * on this method, test if on your page you have or not a form
    * if yes, test form is dirty => yes => msgBox (redirect or cancel redirect)...

  3. #3
    Sencha User
    Join Date
    Dec 2007
    Posts
    69
    Vote Rating
    0
    cblin is on a distinguished road

      0  

    Default


    Hi,

    I do not follow you : I have only one page in my application (i.e with multiple tabs, each tab has a form so I have something like 20 form on my current page). How do I know which form I am currently leaving ?

  4. #4
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    91
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    You don't. You can only use the beforetabchange events of the various tabpanels to check if the current form has pending changes.

  5. #5
    Sencha User
    Join Date
    Dec 2007
    Posts
    69
    Vote Rating
    0
    cblin is on a distinguished road

      0  

    Default


    That was what I was thinking...

    I also tried the global event approach (i.e Ext.util.Observable.observeClass(Ext.TabPanel, {beforetabchange: function(){return false}}) but this does not work because of a strange behavior in createInterceptor (see http://www.sencha.com/forum/showthread.php?111475)

Similar Threads

  1. Replies: 12
    Last Post: 28 Jun 2011, 3:22 AM
  2. Replies: 3
    Last Post: 28 Oct 2009, 6:38 AM
  3. Can i implement "copy and paste" function in grid panel of EXT-GWT?
    By luckyxx in forum Ext GWT: Help & Discussion (1.x)
    Replies: 1
    Last Post: 24 Feb 2009, 11:35 PM
  4. Is there any method to implement "StringToJSON" in Ext?
    By eingmarra in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 27 Dec 2007, 1:25 AM

Thread Participants: 2