-
6 Feb 2013 3:03 AM #1Ext JS Premium Member
- Join Date
- Dec 2010
- Location
- Hamburg, Germany
- Posts
- 179
- Vote Rating
- 1
- Answers
- 1
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 :-)
-
6 Feb 2013 7:13 AM #2Sencha - Community Support Team
- Join Date
- May 2012
- Location
- Istanbul
- Posts
- 1,331
- Vote Rating
- 76
- Answers
- 124
Hi,
you can see this link:http://docs.sencha.com/ext-js/3-4/#!...m-method-reset , http://docs.sencha.com/ext-js/4-1/#!...m-method-resetsword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.
-
6 Feb 2013 7:21 AM #3Ext JS Premium Member
- Join Date
- Dec 2010
- Location
- Hamburg, Germany
- Posts
- 179
- Vote Rating
- 1
- Answers
- 1
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.
-
7 Feb 2013 1:37 AM #4Ext JS Premium Member
- Join Date
- Dec 2010
- Location
- Hamburg, Germany
- Posts
- 179
- Vote Rating
- 1
- Answers
- 1
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();
-
Yesterday 11:04 AM #5
Just adding my own post here to get updates as I'm seeing the same problem


Reply With Quote