-
2 Mar 2012 9:44 AM #1
Unanswered: dataview with component not refreshing when store is reloaded
Unanswered: dataview with component not refreshing when store is reloaded
When i update my store (i traced in the console that the store is really updated), my dataview.dataview items update just one time.
The second time i press my refresh button, the do not update.
I noticed the updateContainerPanel is not called after the first load.
(Hint, if i don't have an 'id' field in my model, the items are added after the existing ones. If i have an 'id' field, they are not updated.)
Thx a lot for your help !
Code://---------------------------------------------------------------------- Ext.define('ts.view.jobListItem', { extend: 'Ext.dataview.component.DataItem', xtype: 'jobListItem', config: { containerPanel: true }, applyContainerPanel: function(config) { return Ext.factory(config, Ext.Panel, this.getContainerPanel()); }, updateContainerPanel: function(newContainerPanel, oldContainerPanel) { if (oldContainerPanel) { this.remove(oldContainerPanel); } if (newContainerPanel) { var record = this.getRecord(); newContainerPanel.setLayout({ type: 'vbox', align: 'center' }); var jobId = new Ext.Label(); jobId.setHtml(record.get('id')); jobId.addCls('jobItemTitle'); newContainerPanel.add(jobId); this.add(newContainerPanel); } } }); //---------------------------------------------------------------------- Ext.define('ts.views.jobs', { extend: 'Ext.Panel', config:{ title:'Jobs', layout:'fit' }, initialize: function() { this.callParent(); var store = Ext.create('ts.store.jobsStore'); var jobsList = Ext.create('Ext.DataView', { disableSelection:true, plugins: [ { xclass: 'Ext.plugin.PullRefresh', pullRefreshText: 'Update jobs' } ] , store: store, useComponents: true, defaultType: 'jobListItem' }); var refreshButton = Ext.create('Ext.Button', { text: 'Refresh jobs', handler: function(button, e) { store.load(); jobsList.refresh(); console.log('refresh'); } }); refreshButton.setDocked('top'); refreshButton.setIconCls('refresh'); this.add(refreshButton); this.add([jobsList]); } });
-
2 Mar 2012 12:32 PM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,641
- Vote Rating
- 434
- Answers
- 3107
What ST2 version are you using?
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
2 Mar 2012 12:44 PM #3
-
3 Mar 2012 1:24 AM #4
-
8 May 2012 12:07 PM #5
Having the same problem...
Having the same problem...
Any thoughts yet?
-
8 May 2012 12:28 PM #6
Show us the store`s model definition.
Hint: id field is used by default as primary key by model unless you specified other way.
-
8 May 2012 12:37 PM #7
Some details...
Some details...
Here is my model...
Here is my dataItem...Code:Ext.define('PhoenixTouch.model.Orders',{ extend: 'Ext.data.Model', requires:'Ext.DateExtras', xtype: 'ordersModel', config: { fields: [ {name: 'DateCollect', type: 'DATE', dateFormat: 'MS'}, {name: 'PatientID', type: 'STRING'}, {name: 'ProviderID', type: 'INT'}, {name: 'UserID', type: 'INT'}, {name: 'TestOrdered', type: 'STRING'}, {name: 'Type', type: 'STRING'}, {name: 'LabReqID', type: 'INT'}, {name: 'CptCode', type: 'STRING'}, {name: 'Modifier', type: 'STRING'}, {name: 'OrdResults', type: 'STRING'}, {name: 'Code', type: 'STRING'}, {name: 'OrderStatus', type: 'STRING'}, ] } });
Code:dataMap: { getDescription: { setHtml: 'CptCode' } }, cls: 'orderTabBar-data-item', description:{ }, layout: { type: 'hbox' } }, applyDescription: function(config) { return Ext.factory(config, Ext.Component, this.getDescription()); }, updateDescription: function(newDesc) { if (newDesc) { this.add(newDesc); } },
Apply and Update are only called the first time I load the dataview. I have even tried to call Refresh from my controller. Another question - is it possible to dynamically set the DataMapped values? Example: if I wanted to change...
Code:dataMap: { getDescription: { setHtml: 'CptCode' } },
to...
Code:dataMap: { getDescription: { setHtml: 'CptDescription' } },
thanks,
Monty
-
8 May 2012 2:23 PM #8Sencha - Community Support Team
- Join Date
- Jan 2009
- Location
- Palo Alto, California
- Posts
- 1,941
- Vote Rating
- 6
- Answers
- 29
You should definitely use the GA release instead of any of the RC builds as a good number of issues were addressed between those releases
Ext JS Senior Software Architect
Personal Blog: http://edspencer.net
Twitter: http://twitter.com/edspencer
Github: http://github.com/edspencer


Reply With Quote