1. #1
    Sencha User
    Join Date
    Apr 2010
    Posts
    12
    Vote Rating
    0
    The_Anomaly is on a distinguished road

      0  

    Default combobox not displaying loaded data

    combobox not displaying loaded data


    I'm having some pain trying to get my combobox to display data from a direct store.

    The direct store is as follows:
    Code:
    Ext.define('MyApp.store.Provinces', {    extend: 'Ext.data.Store',
    
        requires: [
            'MyApp.model.ProvincesModel'
        ],
    
        constructor: function(cfg) {
            var me = this;
            cfg = cfg || {};
            me.callParent([Ext.apply({
                autoLoad: false,
                filterOnLoad: false,
                model: 'MyApp.model.ProvincesModel',
                sortOnLoad: false,
                storeId: 'ProvincesStore',
                proxy: {
                    type: 'direct',
                    directFn: Geo.getProvinces,
                    paramsAsHash: false,
                    reader: {
                        type: 'json',
                        idProperty: 'provinceid',
                        root: 'data',
                        totalProperty: 'totalCount'
                    }
                },
                fields: [
                    {
                        name: 'countryid',
                        type: 'string'
                    },
                    {
                        name: 'provinceid',
                        type: 'string'
                    },
                    {
                        name: 'provincename',
                        type: 'string'
                    }
                ]
            }, cfg)]);
        }
    });
    The combobox code is:
    Code:
    {                            xtype: 'combobox',
                                anchor: '100%',
                                fieldLabel: 'Province',
                                name: 'province',
                                emptyText: 'Select a province...',
                                selectOnFocus: true,
                                displayField: 'provincename',
                                forceSelection: true,
                                growToLongestValue: false,
                                hiddenName: 'provinceid',
                                store: 'Provinces',
                                typeAhead: true,
                                valueField: 'provinceid'
                            },
    The JSON retruned from the direct API is:
    Code:
    {
        "type": "rpc",
        "tid": 1,
        "action": "Geo",
        "method": "getProvinces",
        "result": {
            "success": true,
            "totalCount": 15,
            "data": [
                {
                    "countryid": "1",
                    "provinceid": "7",
                    "provincename": "Eastern Cape"
                },
                {
                    "countryid": "1",
                    "provinceid": "6",
                    "provincename": "Free State"
                },
                {
                    "countryid": "5",
                    "provinceid": "17",
                    "provincename": "Gaborone"
                },
                {
                    "countryid": "1",
                    "provinceid": "2",
                    "provincename": "Gauteng"
                },
                {
                    "countryid": "1",
                    "provinceid": "1",
                    "provincename": "KwaZulu Natal"
                },
                {
                    "countryid": "3",
                    "provinceid": "12",
                    "provincename": "Lesotho"
                },
                {
                    "countryid": "1",
                    "provinceid": "8",
                    "provincename": "Limpopo"
                },
                {
                    "countryid": "6",
                    "provinceid": "19",
                    "provincename": "Maputo"
                },
                {
                    "countryid": "2",
                    "provinceid": "10",
                    "provincename": "Matsapa"
                },
                {
                    "countryid": "1",
                    "provinceid": "5",
                    "provincename": "Mpumalanga"
                },
                {
                    "countryid": "4",
                    "provinceid": "16",
                    "provincename": "Namibia"
                },
                {
                    "countryid": "5",
                    "provinceid": "18",
                    "provincename": "North East"
                },
                {
                    "countryid": "1",
                    "provinceid": "4",
                    "provincename": "North West Province"
                },
                {
                    "countryid": "1",
                    "provinceid": "20",
                    "provincename": "Northern Cape"
                },
                {
                    "countryid": "2",
                    "provinceid": "11",
                    "provincename": "Swaziland"
                },
                {
                    "countryid": "1",
                    "provinceid": "3",
                    "provincename": "Western Cape"
                }
            ]
        }
    }
    Please, please, please can someone assist. When I click on the combo it requests the info remotely from the API, as shown above, BUT the drop down remains empty with the load mask still turning. No items. I have tried without using the model and with the model, no change.

    What am I missing?
    Last edited by mitchellsimoens; 15 Aug 2013 at 9:33 AM. Reason: format json

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,647
    Vote Rating
    899
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    First step I would do to debug is to inspect the store to make sure it has data in it.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    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 in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Apr 2010
    Posts
    12
    Vote Rating
    0
    The_Anomaly is on a distinguished road

      0  

    Default


    Thanks for your reply, however the part where I say: "The JSON retruned from the direct API is:" is the data that is returned from the api and it's what I copied from the inspector. The router.php returns a 200 code.

    When I copy the data attribute from the [ bracket to ] bracket and paste it into a normal store (data attribute) the combo works, meaning it's not the data that's corrupt.

    There are no errors in the console.

    I did this code in Architect 2. I must confess I'm trying with intent to buy and every time I consider it, I hit a wall with this app, which no one can answer. This seems like a bug to me.

    I don't understand. The direct api should be the way every desktop style app should be made, it has such potential, but the amount of info and tutorials for it, and support is seriously lacking.

    I currently use the direct API for a project which is a great success which I designed by hand and text editor, it just never works in Architect. I need an IDE style app to speed up my work.

    I need answer to this question. Please. Preferably before my trial runs out. Sorry if I'm venting too much.


  4. #4
    Sencha User
    Join Date
    Apr 2010
    Posts
    12
    Vote Rating
    0
    The_Anomaly is on a distinguished road

      0  

    Default


    I have now moved all the API files from my working project into the folder of the non working project. The first batch was generated by Sencha Architect version 2.0.0. The non-working project is done in Sencha Architect version 2.2.2. So...

    Working:
    Ext JS 4.0.x
    Sencha Architect version 2.0.0.

    Not working:
    Ext JS 4.2.x
    Sencha Architect version 2.2.2.

    I used winmerge to compare the PHP files and router and API and they're a perfect match between both projects, yet the combobox works in the older version but not in the new version.

  5. #5
    Sencha User
    Join Date
    Apr 2010
    Posts
    12
    Vote Rating
    0
    The_Anomaly is on a distinguished road

      0  

    Default


    I have now somehow resolved this.

    First I matched all the component names and settings between the two projects. That didn't work.

    I then replaced the metadata files of the non working project with the working and updated the xds file to match the names of the "new" elements.

    Seems there was something wrong with the Architect metadata. Lousy 2 day delay. Not inspiring a sale!

Thread Participants: 1

Tags for this Thread