Hybrid View
-
24 Mar 2011 10:48 AM #1
How to pre-populate a Select menu UI item on Load of the Card (View)
How to pre-populate a Select menu UI item on Load of the Card (View)
Hi,
I like to know this, is there a way to pre-populate a Select menu UI item on Load of a Card that its in.
It like this, my app has a main menu that contains a button that pulls up the member settings card (screen) that contains a number of Select Menu UI items that I want to pre-populate with data from the database. Please let me know if thats possible and doable.
thanks in advance.
-
24 Mar 2011 2:02 PM #2
If you're using a Ext.form.Select, it has a 'store' property for just this purpose, so you should be able to do that. Eg set up a model and store to pull from your database, and bind the select to that store. Something like that...
-
24 Mar 2011 2:04 PM #3
Sounds easy enough but there's no sample code that actually shows how to do what you said. Especially from a Database.
Thanks anyway. but I do need sample codes
-
24 Mar 2011 2:09 PM #4
Sure:
Code:Ext.regModel('MyOption', { fields: [ {name: 'text', type: 'string'}, {name: 'value', type: 'string'} ] }); var myStore = new Ext.data.Store({ model: 'MyOption', proxy: { type: 'ajax', url : '/return-my-options-from-database.json.php', reader: { type: 'json', root: 'users' } }, autoLoad: true }); ... new Ext.form.Select({ store: myStore, displayField: 'text', // This is the default and you could remove it valueField: 'value' // Ditto });
-
24 Mar 2011 2:26 PM #5
/// Here's my additional dilemma that I still need help.
/// There are like five select menus that will display all the same data from the store.
/// Here's the thing, each select menu will have a different selected item base on user settings store
in the database.
I can tell you now, the items are a list of neighborhoods and the each select menu will have a different
neighborhood pre-selected onLoad of the card.
I know how to do this in regular website in PHP, but I definately have trouble doing it with this framework.
-
24 Mar 2011 2:58 PM #6
That should be fine, simply have 5 selects all with store: myStore
Similar Threads
-
(Newbie) Remote load combo options and select an item
By ziggurat in forum Ext 2.x: Help & DiscussionReplies: 11Last Post: 26 Dec 2011, 12:55 AM -
Selected item in select (dropdown menu).
By ediew in forum Sencha Touch 1.x: DiscussionReplies: 0Last Post: 27 Jul 2010, 4:12 AM -
How To Select Item In A Combo Then Trigger Load Or Select In Another Combo ??
By chalu in forum Ext GWT: DiscussionReplies: 2Last Post: 12 Jul 2010, 9:20 AM -
How to return the cursor after select a menu item?
By kohyea in forum Ext 3.x: Help & DiscussionReplies: 0Last Post: 2 Dec 2009, 10:06 PM -
select item in a view when object is hold in memory
By steffenk in forum Ext 1.x: Help & DiscussionReplies: 8Last Post: 24 Aug 2007, 1:10 PM


Reply With Quote