-
30 Mar 2012 11:12 AM #1
PullRefresh duplicate items
PullRefresh duplicate items
Hi,
I am experiencing a strange problem with the pull to refresh list plugin. When I load the data normally via store.load() it is cleared and loaded correctly. When I reload the store via the pull to refresh items are getting duplicated (previous ones are not getting cleard).
I tried to add a listeners to the store (beforeload, load, updaterecord etc.) but all of these are not fired when using reloading via the store.
here is my store config:
I also tried adding the root: {} to the store as seen in a diffrent post as bug fix.. but that didn't help. As mentioned it only happens when reloaded via the pull-to-refresh action... normal .load(), reload() work as expected.Code:var store = new Ext.data.Store({ model: 'Test', autoLoad: true, grouper: {groupFn: function(record) { try { return record.get('last_name')[0].toUpperCase(); } catch(err) { } } }, proxy: { type: 'scripttag', autoAbort: true, url: serverurl, extraParams: {meta: true, task: "test", timestamp: new Date().getTime() // if not passed values are cached ! only mobile }, reader: { type: 'json', rootProperty: 'root' } } });
-
30 Mar 2012 11:29 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,641
- Vote Rating
- 434
Do you have an idProperty set on the model? The records are matched by id.
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.
-
30 Mar 2012 8:51 PM #3
Hi, no I didn't.
If I set an idProperty didn't fix the problem though.
Code:Ext.define('Test', {extend: "Ext.data.Model", config: { idProperty: 'test', fields: [ {name: 'tst1', type: 'int'}, {name: 'tst2', type: 'string'}, {name: 'tst3', type: 'string'}, {name: 'tst4', type: 'string'}, {name: 'tst5', type: 'int'}, {name: 'tst6', type: 'int'} ]} });
-
5 Apr 2012 3:48 AM #4
@squarefan
idProperty should point to unique record by which each model object can be differentiated ... check your field name
-
17 Jun 2012 10:15 PM #5
Pull and refresh adding new record with old record as well ..
Pull and refresh adding new record with old record as well ..
//Below is my list em binding data from web service call
//In controller when user adds review to load list again em using below codeCode:{ xtype:'list', id:'userReviewList', plugins:[ { xclass:'Ext.plugin.ListPaging', autoPaging:true } ], title:'User Review', cls:'reviewList', flex:1, store:{ autoLoad:true, id:'reviewStore', idProperty: 'ReviewId', clearOnPageLoad: false, fields:['Comment', 'Rating', 'ReviewId', 'RatingUrl'], proxy:{ type:'jsonp', url:'http://url/PropertyService.svc/GetUserReviewDetails?projectId=1', reader:{ type:'json', rootProperty:'d' } } },
//But now i need to reload the list data by scrolling it when other user add the review comment. Even i am using idProperty which is unique to list. The list is refreshing new value with old values as well and list keep on loading so i need to load only updated record not with old data as wellCode:Ext.getStore('reviewStore').load();
-
5 Oct 2012 7:44 AM #6
I experienced the same thing so the fix that did the work for me was to declare my own refreshFn
It did the trick for meCode:plugins: [ { xclass: 'Ext.plugin.PullRefresh', pullRefreshText: 'Pull down for fresh beer', refreshFn: function() { console.log("Boom"); Ext.getStore('BeerStore').load(); }, } ],
PS. this solution might be against the purpose of refresh. From what i understood the plugin doesn't do anything on the store.
i could use some clarification as well
Last edited by maresh2all; 5 Oct 2012 at 7:58 AM. Reason: epiphany
-
1 Apr 2013 1:22 PM #7
I ran across this thread and thought I'd post the solution. The idProperty is a pointer to the field in your model that contains the unique ID of your record set. Your configuration would look something like this:
Code:Ext.define('Test', { extend: "Ext.data.Model", config: { idProperty: 'tst1', //note this maps to an actual field below fields: [ {name: 'tst1', type: 'int'}, {name: 'tst2', type: 'string'}, {name: 'tst3', type: 'string'}, {name: 'tst4', type: 'string'}, {name: 'tst5', type: 'int'}, {name: 'tst6', type: 'int'} ]} });Last edited by pherris; 1 Apr 2013 at 1:25 PM. Reason: code formatting was lost
-
2 Apr 2013 6:34 AM #8
Your idProperty should point to the field 'name', not a value in the field. In addition, every possible value inside your 'name field' should be unique. If it's possible that the name field could potentially include 'tst1' many times, don't use that field, find another or create a new field with a combination of values that would make that row unique.
Hope that helps
John


Reply With Quote