1. #1
    Ext JS Premium Member
    Join Date
    Dec 2010
    Location
    Hamburg, Germany
    Posts
    196
    Vote Rating
    7
    Answers
    1
    winkelmann will become famous soon enough

      0  

    Default Unanswered: Ext.form.Basic.reset(true) retains record values

    Unanswered: Ext.form.Basic.reset(true) retains record values


    I have a form with trackResetOnLoad=true that I load a record into with loadRecord(). If I then reset the form with resetRecord=true, it deletes the record internally, but it does not reset the form to actual empty values.

    In my oppinion if i have the form bound to a record via trackResetOnLoad, the form fields should be reset to empty values rather than having to fix the values manually.

    Any insight is appreciated :-)

  2. #2
    Sencha - Community Support Team sword-it's Avatar
    Join Date
    May 2012
    Location
    Istanbul
    Posts
    1,333
    Vote Rating
    85
    Answers
    124
    sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough

      0  
    sword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.

  3. #3
    Ext JS Premium Member
    Join Date
    Dec 2010
    Location
    Hamburg, Germany
    Posts
    196
    Vote Rating
    7
    Answers
    1
    winkelmann will become famous soon enough

      0  

    Default


    I know about the reset function, thats what I'm complaining about ;-) You linked to Ext3 docs by the way, I'm using 4. My problem is that if I call reset(true) on the form, it resets the form to the original values provided by the record i loaded into it using loadRecord(), rather than resetting it to either empty values or the values the form had before loading the record.

  4. #4
    Ext JS Premium Member
    Join Date
    Dec 2010
    Location
    Hamburg, Germany
    Posts
    196
    Vote Rating
    7
    Answers
    1
    winkelmann will become famous soon enough

      0  

    Default


    I created a little test case to reproduce the effect. Simply click on the grid record to load it into the form, then click reset. The form data will not change because the fields original value was reset by trackResetOnLoad=true, when removing the record, the field still retains the value though.

    Code:
    Ext.define('TestWindow', {
        extend: 'Ext.window.Window',
    
        onGridSelectionChange: function(g, recs) {
            this.down('form').loadRecord(recs[0]);
        },
    
        onResetBtnClick: function() {
            this.down('form').getForm().reset(true);
        },
    
        initComponent: function() {
            var me=this;
    
            me.items = [{
                flex: 1,
                xtype: 'grid',
                store: me.store,
                columns: [{
                    flex: 1,
                    dataIndex: 'test',
                    header: 'Test'
                }],
                listeners: {
                    scope: me,
                    selectionchange: me.onGridSelectionChange
                }
            },{
                xtype: 'form',
                flex: 1,
                trackResetOnLoad: true,
                items: {
                    columnWidth: 0.4,
                    margin: '10',
                    autoScroll: true,
                    xtype: 'fieldset',
                    title: 'Edit entry',
                    defaultType: 'textfield',
                    items: [{
                        fieldLabel: 'Test',
                        name: 'test'
                    }]
                }
            }];
    
            me.dockedItems = [{
                xtype: 'toolbar',
                dock: 'bottom',
                items: [{
                    text: 'Reset form',
                    scope: me,
                    handler: me.onResetBtnClick
                }]
            }];
    
            me.callParent();
        },
    
        constructor: function() {
            this.store = Ext.create('Ext.data.Store', {
                fields: ['test'],
                data: [{test: 'Field data'}]
            })
    
            this.callParent([{
                width: 300,
                height: 300,
                layout: {
                    type: 'vbox',
                    align: 'stretch'
                }
            }]);
        }
    });
    
    Ext.create('TestWindow').show();

  5. #5
    Ext JS Premium Member
    Join Date
    Feb 2009
    Posts
    449
    Vote Rating
    5
    Answers
    4
    Jangla is on a distinguished road

      0  

    Default


    Just adding my own post here to get updates as I'm seeing the same problem

Thread Participants: 2