Results 1 to 2 of 2

Thread: Multi-type grid cell: how to preserve date format

  1. #1
    Sencha Premium Member
    Join Date
    Mar 2007
    Posts
    179
    Answers
    3
    Vote Rating
    1
      0  

    Question Multi-type grid cell: how to preserve date format

    I have a grid with multiple types (set with renderer and getEditor). if the filed is a Date, the format of the displayed date changes after new date is selected from '2017-04-20' to smth like 'Wed Apr 20 2017 00:00:00 GMT (Eastern Daylight Time)'
    and the value sent to server is '2017-04-20T00:00:00' on save.

    I created the fiddle with sample code. I am not really familiar how to emulate saving to the server so I removed the code

    Code:
    handler: function() {
                var recs = grid.getStore().getModifiedRecords();
                if (recs && recs.length > 0) {
                  grid.getStore().sync({
                    success: function() {
                      Ext.MessageBox.alert('Success!', 'Outage Status Configuration has been updated.');
                    }
                  });
                }
              }
    https://fiddle.sencha.com/#view/editor&fiddle/1uak


    what am I missing? how do I preserve the date format?

    Thank you!

  2. #2
    Sencha Premium Member
    Join Date
    Mar 2007
    Posts
    179
    Answers
    3
    Vote Rating
    1
      0  

    Default

    solved by adding a listener
    Code:
    listeners: {
            edit: function (editor, context, eOpts) {
              if (context.record.get('type') === 'ValueDate') {
                var newVal = Ext.Date.format(context.value, 'Y-m-d');
                context.record.set('value', newVal);
              }
            }
          },

Similar Threads

  1. Replies: 3
    Last Post: 17 May 2013, 8:52 AM
  2. Replies: 2
    Last Post: 10 Jan 2013, 1:18 AM
  3. date format on grid. Format is not displayed as expected.
    By mcrusty in forum Ext 1.x: Help & Discussion
    Replies: 3
    Last Post: 26 Jan 2007, 4:05 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •