Hybrid View

  1. #1
    Sencha User
    Join Date
    Dec 2010
    Posts
    18
    Vote Rating
    0
    mailboxo71 is on a distinguished road

      0  

    Default 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.

  2. #2
    Sencha User d5chris's Avatar
    Join Date
    Feb 2011
    Location
    Sydney
    Posts
    59
    Vote Rating
    2
    d5chris is on a distinguished road

      0  

    Default


    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...

  3. #3
    Sencha User
    Join Date
    Dec 2010
    Posts
    18
    Vote Rating
    0
    mailboxo71 is on a distinguished road

      0  

    Default


    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

  4. #4
    Sencha User d5chris's Avatar
    Join Date
    Feb 2011
    Location
    Sydney
    Posts
    59
    Vote Rating
    2
    d5chris is on a distinguished road

      0  

    Default


    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
    });

  5. #5
    Sencha User
    Join Date
    Dec 2010
    Posts
    18
    Vote Rating
    0
    mailboxo71 is on a distinguished road

      0  

    Default


    /// 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.

  6. #6
    Sencha User d5chris's Avatar
    Join Date
    Feb 2011
    Location
    Sydney
    Posts
    59
    Vote Rating
    2
    d5chris is on a distinguished road

      0  

    Default


    That should be fine, simply have 5 selects all with store: myStore

Similar Threads

  1. (Newbie) Remote load combo options and select an item
    By ziggurat in forum Ext 2.x: Help & Discussion
    Replies: 11
    Last Post: 26 Dec 2011, 12:55 AM
  2. Selected item in select (dropdown menu).
    By ediew in forum Sencha Touch 1.x: Discussion
    Replies: 0
    Last Post: 27 Jul 2010, 4:12 AM
  3. Replies: 2
    Last Post: 12 Jul 2010, 9:20 AM
  4. How to return the cursor after select a menu item?
    By kohyea in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 2 Dec 2009, 10:06 PM
  5. select item in a view when object is hold in memory
    By steffenk in forum Ext 1.x: Help & Discussion
    Replies: 8
    Last Post: 24 Aug 2007, 1:10 PM

Thread Participants: 1

Tags for this Thread

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar