1. #1
    Sencha User
    Join Date
    Sep 2012
    Posts
    5
    Vote Rating
    0
    Mooi is on a distinguished road

      0  

    Default Unanswered: Grid empty afer reconfigure()

    Unanswered: Grid empty afer reconfigure()


    I like to create a site with some Gridpanels wit some dummy stores.
    At runtime the Gridpanel and Stores have to be filled with real data.

    The code below works, except that after the 'reconfigure()' my grid is empy, however the headers are filled ok.
    The store is filled correctly also.
    What is wrong in my code?

    I am using a test Complete Sencha from a few weeks ago.


    Code:
            initStores: function() {
            MyApp.uid = 'jan';
            MyApp.pwd = '123';
            MyApp.domain = 'tspalm:8082' ;
            var storeId = 'PARTIJ_DETAIL';
    
            var sqlCommandId = 'PARTIJ';
            var sqlView = 'DETAIL';
            var store = Ext.getStore('Headers');
            store.getProxy().url = 'http://www.wmysite.com/callback.php?loginUsername=' + MyApp.uid + '&loginPassword=' + MyApp.pwd + '&loginIp=' + MyApp.domain + '&level=8&commandid=' + sqlCommandId + '&viewid=' + sqlView + '&params=';
            store.remove(store.getRange());
            store.load({
                scope : this,
                callback: function(records, operation, success) {
                    if (success) {
    
                        console.log('Headers gelezen');
                        console.log(records);           
                        // initiate arrays
                        var fieldNames = [];
                        var modelFields = [];
                        var columnNames = [];
    
    
                        Ext.Array.each(records, function(prop) {
                            fieldNames.push(prop.data.cname);
                        });
    
    
                        Ext.Array.each(fieldNames, function(fldname){
                            modelFields.push({name: fldname, type: 'string'});
                        });            
    
    
                        Ext.Array.each(fieldNames, function(fldname){
                            columnNames.push({dataindex: fldname, 
                                text: fldname, 
                                flex: 1,
                            xtype: 'gridcolumn'});
                        });            
    
                        var storeResults = new Ext.data.Store({
                            storeId: 'MyStore1',
                            id: storeId ,
                            proxy: {
                                type: 'jsonp',
                                url : 'http://www.myweb.com/callback.php?loginUsername=' + MyApp.uid + '&loginPassword=' + MyApp.pwd + '&loginIp=' + MyApp.domain + '&level=9&commandid=' + sqlCommandId + '&viewid=' + sqlView + '&params=',
                                reader: {
                                    type: 'json',
                                    root: 'row'
                                }
                            },
                            fields: modelFields
                        });
    
    
                        storeResults.load({
                            scop: this,
                            callback: function(records, operation, success) {
                                if (success) {
                                }
                                console.log(storeResults);
    //in the Console If ound that the Store is correctly filled
                                var mygrid = Ext.getCmp('upperdw');
                                console.log(columnNames);
                                mygrid.reconfigure(storeResults, columnNames);
    //Here my grid is empty, correct headers without data
                            }});
    
    
                        }
                    } 
                });
    
        },

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,073
    Answers
    3500
    Vote Rating
    853
    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


    Is this question for Ext JS 4?
    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.

Thread Participants: 1