-
27 Dec 2011 5:05 PM #1
Disable set active item in a controller when data returned is empty
Disable set active item in a controller when data returned is empty
I have a controller as shown below:
Here i don't want to set the active items if the data in the store is empty.Code:showMapBasedOnInputLocation: function (options) { GetData(options.id[0], options.id[1]); Ext.getCmp('FilterSelect').setOptions([ { text: 'Availability', value: 'Availability' }, { text: 'Price', value: 'Price' }, { text: 'Proximity', value: 'Proximity' } ]); Ext.getCmp('mytab').setActiveItem(0); map.graphics.clear(); this.application.viewport.setActiveItem( App.views.result, { type: 'slide', direction: 'right' } ); },
but does not seem to work.Code:if(App.stores.ParkingFacility.data.items.length > 0) { this.application.viewport.setActiveItem( App.views.result, { type: 'slide', direction: 'right' } ); }
Any suggestion or ideas i could use.
Regards,
Pawan
-
28 Dec 2011 8:01 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,714
- Vote Rating
- 436
You have a timing issue. Why not have the if statement with in your first code snippet?
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.
-
28 Dec 2011 9:24 AM #3
I do have it in my first Statement. I think the problem is the GetData() method make a jsonp request and once the jsonp request (asynchronous ) is executed it immediately passes control to controller back and executes the code below.
Is there any way i could make it wait until i get all my data back and then execute the set active method. can you help me out with any sample code.Code:this.application.viewport.setActiveItem( App.views.result, { type: 'slide', direction: 'right' } );


Reply With Quote