-
24 Apr 2012 11:10 AM #11Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,641
- Vote Rating
- 434
- Answers
- 3107
That object in the console will get updated as long as you haven't expanded. So if you console.log(store) and the store finishes being loaded before you expand the store then you will see the updated store.
You need to get a number or string or boolean to see if the store has loaded, I usually do
That will not update as the store loads.Code:console.log(store.getCount());
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.
-
24 Apr 2012 3:20 PM #12
I have this and it works for me:
Store:
List:Code:var listaMatStore = new Ext.data.Store ({ autoLoad: true, model: 'listaMatModel', sorters: 'DescMaterial', getGroupString : function(record) { // Group by the last name return record.get('DescMaterial')[0]; }, proxy: { type: 'rest', url: 'data/materiales.txt', reader: { type: 'json', root : 'root' } } });
Code:var listaMat = new Ext.List({ id: 'listaMat', store: listaMatStore, grouped: true, itemTpl: '<div class="materialItem">'+ '<div class="item-img"><img src="resources/images/shopping_cart.png" width="50" height="50"></div>'+ '<div style="float:left; width:90%;">'+ '<div class="list-codigo">'+ '<span>{CodMaterial} {CodUMedida}-{UMedidaRendimiendo}</span>'+ '<br />'+ '{DescMaterial}'+ '</div>'+ '<div class="list-peso">'+ '<span>Peso: {Peso} KG Precio: {PrecioUnit} PEN</span>'+ '<br />'+ '<span>Stock: {Stock} UN</span>'+ '</div>'+ '</div>'+ '</div>', listeners: { 'render': function (thisComponent) { var desc = formBuscaMat.getValues().descripcion; if(desc){ thisComponent.getStore().load(); thisComponent.getStore().filter('DescMaterial',desc); } else{ thisComponent.getStore().load(); } } } });
-
4 May 2012 1:19 PM #13
Don't you filterBy before loading?
Don't you filterBy before loading?
I may be misunderstanding the life cycle of the store but I thought filterBy determines what gets loaded when you call store.load();
So, If we do this:
store.filterBy(function(item,id){
//If we found the correct item
return true;
}, this);
store.load();
The store should now have the records filtered by the criteria.
Is this a correct assumption?
If I am correct, then why should the store already have items in its data before applying the filter?


Reply With Quote