Results 1 to 2 of 2

Thread: How to fill a combobox with grid columns information?

  1. #1

    Default How to fill a combobox with grid columns information?

    Hi,

    I'm trying to fill a combobox with a grid columns information with as code below,


    Code:
    var grid = Ext.getCmp('gridPanel');
    new Ext.form.ComboBox({
                        id: 'cmbSearchCriterias',
                        store: new Ext.ux.data.PagingStore({
                            id: "strComboStore",
                            ajaxEventConfig: {
                                formProxyArg: "form1"
                            },
                            reader: new Ext.data.JsonReader({
                                fields: [{ name: "Text" }, { name: "Value"}],
                                id: "Value"
                            }),
                            autoLoad: true,
                            proxy: new Ext.data.PagingMemoryProxy({})
                        }),
                        displayField: 'Text',
                        valueField: 'Value',
                        triggerAction: 'all',
                        mode: 'local',
                        onFocus: function() {
                            var combobox = this;
                            combobox.store.removeAll();
                            //var data = new Array();
                            Ext.each(grid.colModel.columns, function(col, i) {                            
                                combobox.insertRecord(i, { Text: col.header, Value: col.dataIndex });
                                // alert(col.header);
                            }); // eof each
                        }
                     });
    If I execute the alert function inside the each iteration, it works well and showing me the column header. But the insertRecord method is not working. I wanted to list the column headers of a grid into a combobox when the combobox is focused.

    Thanx.

  2. #2
    Sencha User jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    DC Area =)
    Posts
    16,364

    Default

    why not just add the record instead of insert?

Similar Threads

  1. How to fill a combobox with grid columns information?
    By xantiax in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 13 Jul 2010, 4:22 AM
  2. How to change the displayed information in ComboBox with hiddenValue?
    By evil_elf in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 23 Apr 2010, 7:22 AM
  3. how to bring to center and fill a color in table columns
    By extjsrrr in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 26 Jan 2009, 12:53 AM

Posting Permissions

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