Hybrid View

  1. #1
    Sencha User
    Join Date
    Jun 2011
    Posts
    14
    Vote Rating
    0
    sukant.sahoo is on a distinguished road

      0  

    Default combobox as editor in grid not loading for 2nd time

    combobox as editor in grid not loading for 2nd time


    Hi

    I have grid having combobox as editor in one column.
    To update a record in grid , I want to select data from combobox editor.
    First time the data in combo box loading.
    It means
    After data loaded in the grid after page loaded(grid object newly created ) then if I click on the combo box editor it is loading data proper.
    If I reload the grid after selecting value for combobox editor then I click the combobox editor , it is not loading the data.

    To reload the grid I used reconfigure API.

    I have attached screen shot for reference. Please help ASAP.
    Attached Images

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    8,637
    Vote Rating
    400
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    Please check the following. I was not able to duplicate what you described.

    Code:
    Ext.onReady(function(){
        // sample static data for the store
        var myData = [
            ['3m Co',                               71.72, 0.02,  0.03,  '9/1 12:00am'],
            ['Alcoa Inc',                           29.01, 0.42,  1.47,  '9/1 12:00am'],
            ['Altria Group Inc',                    83.81, 0.28,  0.34,  '9/1 12:00am'],
            ['American Express Company',            52.55, 0.01,  0.02,  '9/1 12:00am'],
            ['American International Group, Inc.',  64.13, 0.31,  0.49,  '9/1 12:00am'],
            ['Verizon Communications',              35.57, 0.39,  1.11,  '9/1 12:00am'],            
            ['Wal-Mart Stores, Inc.',               45.45, 0.73,  1.63,  '9/1 12:00am']
        ];
    
        // create the data store
        var store = new Ext.data.ArrayStore({
            fields: [
               {name: 'company'},
               {name: 'price',      type: 'float'},
               {name: 'change',     type: 'float'},
               {name: 'pctChange',  type: 'float'},
               {name: 'lastChange', type: 'date', dateFormat: 'n/j h:ia'}
            ]
        });
    
        // manually load local data
        store.loadData(myData);
    
        var combo = new Ext.form.ComboBox({
            typeAhead: true,
            triggerAction: 'all',
            lazyRender:true,
            mode: 'local',
            store: new Ext.data.ArrayStore({
                id: 0,
                fields: [
                    'displayText'
                ],
                data: [['Company One'], ['Company Two']]
            }),
            valueField: 'displayText',
            displayField: 'displayText'
        });
    
        // create the Grid
        var grid = new Ext.grid.EditorGridPanel({
            store: store,
            columns: [
                {
                    id       :'company',
                    header   : 'Company', 
                    width    : 160, 
                    sortable : true, 
                    dataIndex: 'company',
                    editor: combo
                },
                {
                    header   : 'Price', 
                    width    : 75, 
                    sortable : true, 
                    renderer : 'usMoney', 
                    dataIndex: 'price',
                    editor: {
                        xtype: 'textfield',
                        allowBlank: false
                    }
                },
                {
                    header   : 'Change', 
                    width    : 75, 
                    sortable : true, 
                    dataIndex: 'change',
                    editor: {
                        xtype: 'textfield',
                        allowBlank: false
                    }
                },
                {
                    header   : '% Change', 
                    width    : 75, 
                    sortable : true, 
                    dataIndex: 'pctChange'
                },
                {
                    header   : 'Last Updated', 
                    width    : 85, 
                    sortable : true, 
                    renderer : Ext.util.Format.dateRenderer('m/d/Y'), 
                    dataIndex: 'lastChange'
                }
            ],
    
            tbar: [{
                text: 'Reload Store',
                handler: function(){
                    store.load();
                }
            }],
    
            stripeRows: true,
            autoExpandColumn: 'company',
            height: 350,
            width: 600,
            title: 'Array Grid',
            renderTo: Ext.getBody()
        });
    
    });
    Scott

  3. #3
    Sencha User
    Join Date
    Jun 2011
    Posts
    14
    Vote Rating
    0
    sukant.sahoo is on a distinguished road

      0  

    Default


    hi Scott,

    Thanks for ur quick reply.
    I am not seeing the code to refresh the gird data.
    Could please provide the refresh the grid data?
    After first time loading of grid, click on combobox editor then refresh the grid data then click on combobox editor again.

  4. #4
    Sencha User
    Join Date
    Jun 2011
    Posts
    14
    Vote Rating
    0
    sukant.sahoo is on a distinguished road

      0  

    Default


    This code will refresh the grid u load the js file in browser.
    And every time it will create new object of grid. then this problem will not occur.
    Instead of creating new grid object every time use reconfigure api of ext-js to reload the grid second time.
    Please let me know if u r not getting me.

  5. #5
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    8,637
    Vote Rating
    400
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    To make sure I understand .. I load the store and combo. I then click on the button in the toolbar and it loads the grid data again. At this time when I edit the grid, the combo still has it's data.

    Is this correct?

    Scott.

  6. #6
    Sencha User
    Join Date
    Jun 2011
    Posts
    14
    Vote Rating
    0
    sukant.sahoo is on a distinguished road

      0  

    Default


    before loading(refresh) the second time edit it. and then click on combobox editor.<br>If possible while loading grid second time reconfigure the column model because in my code I am reconfigure column model.<br>I am suspecting because of reconfigure it is not working.<br>

Thread Participants: 1

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