Page 2 of 2 FirstFirst 12
Results 11 to 13 of 13

Thread: combobox as editor in grid not loading for 2nd time

  1. #11
    Sencha User
    Join Date
    Jun 2011
    Posts
    14
    Vote Rating
    0
      0  

    Default

    Hi Scott,

    In ur example use xtype:combo instead of new Ext.form.ComboBox'.
    and do reconfigure grid with modified column model(just change the header name). In reload button add code for reconfigure and load the data again.
    After modifying ur code follow the given below steps to reproduce
    1. After page load freshly click on reload button. so that it reconfigure the grid with updated header name.
    2. click on combox editor. It will show data in drop down
    3. click on reload button again and then click on combo box editor.

    This is happening because of xype:combo.
    Please help me how to solve this issue.

  2. #12
    Sencha User
    Join Date
    Jun 2011
    Posts
    14
    Vote Rating
    0
      0  

    Default

    the following code is for reconfigure grid

    updatecm = new Ext.grid.ColumnModel({
    columns:[
    {
    id :'company',
    header : 'Company',
    width : 160,
    sortable : true,
    dataIndex: 'company',
    editor: {
    xtype:'combo',
    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',
    id:'mycombo'
    }
    },
    {
    header : 'MyPrice',
    width : 75,
    sortable : true,
    renderer : 'usMoney',
    dataIndex: 'price',
    editor: {
    xtype: 'textfield',
    allowBlank: false
    }
    },
    {
    header : 'MyChange',
    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'
    }
    ]
    });
    var refGrid = Ext.getCmp('refKeyGrid');
    refGrid.reconfigure(refGrid.getStore(), updatecm);

    please follow the steps which is given in previous post.

  3. #13
    Sencha User
    Join Date
    Jun 2011
    Posts
    14
    Vote Rating
    0
      0  

    Default

    Hi Scott,

    I resolved the issue in the following way
    1. created a combo box
    2. while reconfiguring grid assigning that combo in the editor.
    3. to get the combo component I used Ext.getCmp('mycombo').

    Please let me know whether my approach is correct or not.
    Is there any other way can be fixed this issue?
    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',
    id:'mycombo'
    });


    updatecm = new Ext.grid.ColumnModel({
    columns:[
    {
    id :'company',
    header : 'Company',
    width : 160,
    sortable : true,
    dataIndex: 'company',
    editor: Ext.getCmp('mycombo')
    },
    {
    header : 'MyPrice',
    width : 75,
    sortable : true,
    renderer : 'usMoney',
    dataIndex: 'price',
    editor: {
    xtype: 'textfield',
    allowBlank: false
    }
    },
    {
    header : 'MyChange',
    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'
    }
    ]
    });
    var refGrid = Ext.getCmp('refKeyGrid');
    refGrid.reconfigure(refGrid.getStore(), updatecm);

    Sukant

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •