1. #1
    Ext User
    Join Date
    Apr 2008
    Posts
    33
    Vote Rating
    0
    faisal abbas is on a distinguished road

      0  

    Default loading combo from database

    loading combo from database


    hello every one!
    i want to load a combo box from data base. please help me
    thanks
    Last edited by mystix; 9 Feb 2009 at 9:18 PM. Reason: moved to 2.x Help from Examples

  2. #2
    Ext User
    Join Date
    Dec 2007
    Posts
    42
    Vote Rating
    0
    mbenothmane is on a distinguished road

      0  

    Default


    U can use a JasonStore like you do for grid, you will also need to create a record object, specify fields etc ...

  3. #3
    Sencha User
    Join Date
    Sep 2008
    Location
    Zurich (CH)
    Posts
    155
    Vote Rating
    0
    ExtJSBeginner is on a distinguished road

      0  

    Default


    maybe this helps?

    Code:
    myStore = new Ext.data.JsonStore({
        url: 'urlToYourServer',
        autoLoad : true,
            root: 'yourJsonRootElement',
            fields:[
                     {name: "yourKeyField", type: "string"},
                     {name: "yourValueField", type: "string"}
            ]});
    myCombo = new Ext.form.ComboBox({
        title: 'yourTitle',
        width: 390,
        allowBlank: 'true',
        readOnly: true,
        triggerAction: 'all',
        store: yourStore, 
        valueField: 'yourValueField', 
        displayField : 'yourKeyField' 
        });

  4. #4
    Ext User
    Join Date
    Apr 2008
    Posts
    33
    Vote Rating
    0
    faisal abbas is on a distinguished road

      0  

    Default help again

    help again


    thanks for your reply but .....

    you have told me that what will be happen in Js file.. please tell me what is the format of building array in php file....

    thanks

  5. #5
    Ext User
    Join Date
    Dec 2007
    Posts
    42
    Vote Rating
    0
    mbenothmane is on a distinguished road

      0  

    Default


    use json_encode function to output your populated array. When you fetch your records, they are stored as an array of objects or array of arrays in php. json_encode will format the output that will be readable by Ext component at the client side

  6. #6
    Ext User
    Join Date
    Jul 2007
    Location
    Florida
    Posts
    9,996
    Vote Rating
    5
    mjlecomte will become famous soon enough mjlecomte will become famous soon enough

      0  

    Default


    You may want to post in php forums, that question is a bit out of scope for this forum.

    That said, you might want to check out the tutorials in the wiki, there are few dealing with php. You're going to be sending everything to client using XML or JSON so it's really a matter of you learning how to send one of those data formats from your backend language.

  7. #7
    Ext User
    Join Date
    Jul 2007
    Location
    Florida
    Posts
    9,996
    Vote Rating
    5
    mjlecomte will become famous soon enough mjlecomte will become famous soon enough

      0  

    Default


    Also check the demos in your SDK, there are php files in there also!