Results 1 to 3 of 3

Thread: Loading subset of json into editable combobox in the Grid

  1. #1
    Sencha User
    Join Date
    Nov 2012
    Posts
    6
    Vote Rating
    2
      0  

    Default Loading subset of json into editable combobox in the Grid

    Hi

    I am building a grid based on JSON data which is based on the following

    var subAccountStore = new Ext.data.JsonStore({
    autoLoad: true,
    proxy: {
    type:'ajax',
    url : '/opUI/json/subaccount.action?name="ABC"'
    },
    fields: ['accountName', 'accountNumber','accountNumbers', 'quantity']

    });

    and the sample JSON is

    [{"accountName":"'ABC'","accountNumber":"123456","quantity":100,"accountNumbers":['12345A','12345B','12345C']},{"accountName":"'XYZ'","accountNumber":"999999","quantity":100,"accountNumbers":['99999A','99999B','99999C']}]

    Now I am trying to build grid with editable combo box as one of column

    So my code snippet is
    columns: [
    {
    text : 'Account Name',
    width : 60,
    flex : 3,
    sortable : true,
    dataIndex: 'accountName'
    },
    {
    text : 'Account Number',
    flex : 2,
    sortable : false,
    dataIndex: ???,
    editor: new Ext.form.field.ComboBox({
    typeAhead: true,
    triggerAction: 'all',
    selectOnTab: true,
    store: ???,
    lazyRender: true,
    listClass: 'x-combo-list-small'



    })
    },
    {
    text : 'Quantity',
    flex : 2,
    sortable : true,
    dataIndex: 'quantity',
    align : 'right',
    editor: {
    xtype: 'numberfield',
    allowBlank: false,
    minValue: 0,
    maxValue: 100000
    }
    }
    ]


    I am not sure how to make each row shows combobox of it's accountNumbers.

    I would really appreciate if some one can put me in the right direction.

    Thanks
    Tharahan

  2. #2
    Sencha User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,050
    Answers
    3976
    Vote Rating
    1381
      0  

    Default

    By default the combobox you would need to set a store with it's own data, to get it from the response from the grid, you would need to extend the editing plugin and set the data from the record being edited onto the combobox's store.
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

  3. #3
    Sencha User
    Join Date
    Nov 2012
    Posts
    6
    Vote Rating
    2
      0  

    Default

    Thanks the response.

    Can you give me an example for extending the editing plugin?

    Thanks
    Tharahan

Tags for this Thread

Posting Permissions

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