Jump to content

Unsaved data on a form


Allen

Recommended Posts

I am struggling with the conversion of an ext app (not unigui) into a unigui app.  In my old app I created a lot of windows as follows
 

win = desktop.createWindow({
  id: 'newTicket-win',
  closeAction:'hide',
  title: tTitle,
  iconCls:'icon-help',
  modal:true,
  TixToView: ticketID,
  width:twidth,
  height:theight,
  layout:{
     type:'fit'
  },
  items:[{
     xtype:'ticketForm',
     id: 'ticketFormID',
     flex:1
  }],
  onEsc: function() {
     var me = this;
     me.hide();
  },
  listeners: {
     beforeclose: function( window ) {
        var formPanel = Ext.getCmp('newTicket-win');
        var childPanel = formPanel.down('ticketForm');
           if (childPanel.getForm().isDirty())  {
              Ext.Msg.confirm( 'Closing confirmation', 'You have unsaved data are you sure you want to close?', function( answer ) {
               if( answer == "yes" ) {
                  window.destroy();
               } 
          } );
          return false;
        } 
    }
  }
});

how best does one achieve the equivalent of the beforeclose event from the Ext code above in UniGui.

-Allen

Link to comment
Share on other sites

Hello,

27 minutes ago, Allen said:

I am struggling with the conversion of an ext app (not unigui) into a unigui app.  In my old app I created a lot of windows as follows

Sorry, why?

27 minutes ago, Allen said:

how best does one achieve the equivalent of the beforeclose event from the Ext code above in UniGui.

Can you please explain in more detail?

Link to comment
Share on other sites

Sherzod;

25 minutes ago, Sherzod said:

Sorry, why?

My old environment was isapi dll + ExtJS (This was started with ExtJS 3.x 10+ years ago).  trying to draw lines between how I did things previously and UniGui has been a personal challenge.

29 minutes ago, Sherzod said:

Can you please explain in more detail?

In a generic ExtJS form there is a simple method ".getForm().isDirty()" that keeps track of a user modifying form fields. 

This is nice and simple, relatively bulletproof way of helping the user not lose data edits by navigating away from the form.

1 hour ago, Allen said:
           if (childPanel.getForm().isDirty())  {
              Ext.Msg.confirm( 'Closing confirmation', 'You have unsaved data are you sure you want to close?', function( answer ) {
               if( answer == "yes" ) {
                  window.destroy();
               } 

If there is no similar function within UniGui then I would need to build my own capability attached to every input field in the application which will eventually lead to inconsistencies and potential "LOST" edits.

-Allen

Link to comment
Share on other sites

23 minutes ago, Allen said:

If there is no similar function within UniGui then I would need to build my own capability attached to every input field in the application which will eventually lead to inconsistencies and potential "LOST" edits.

If I understand you correctly, you can search the forum for these keywords: "isValid", "validate"...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...