EditorGrid and different combo boxes

  • Hi,
    I was looking at this thread.

    http://extjs.com/forum/showthread.php?t=5525&highlight=editorgrid+combo

    I have one editable column inside my editorGrid. That editor is combo box but I have to load the store of that combo based on the current row's id. I tried to apply method from above thread:


    Ext.apply(Ext.grid.ColumnModel.prototype,{
    getCellEditor : function(colIndex,rowIndex) {
    var editor = this.config[colIndex].editor;
    if (typeof(editor) == 'function') {
    editor = editor(colIndex,rowIndex);
    if (editor && editor.isFormField) {
    editor = new Ext.grid.GridEditor(editor);
    }
    }
    return(editor);
    }
    });


    And inside columnModel,


    {
    id: 'fulladdress',
    header: 'Full Address',
    dataIndex: 'fulladdress_id',
    width: 135,
    editor:function(colIndex,rowIndex) {

    //grid_select_recipients is grid variable
    currentProvider_id = grid_select_recipients.store.data.items[rowIndex].get('provider_id');

    //addresses_dd_ds is data store for combo
    addresses_dd_ds.load({params:{dropdowns:'locations ',provider_id:currentProvider_id}});
    return new Ext.form.ComboBox({
    store: addresses_dd_ds,
    editable: false,
    forceSelection: true,
    mode:'remote',
    displayField: 'name',
    valueField: 'id',
    allowBlank:true,
    typeAhead: true,
    triggerAction: 'all',
    selectOnFocus:true,
    lazyRender:false,
    listWidth:350
    });
    },
    renderer:renderSelect
    },
    .
    .
    .
    .
    //custom renderer function
    function renderSelect (value, p, record, rowIndex, colIndex, ds) {
    var cm = grid_select_recipients.getColumnModel();
    var ce = cm.getCellEditor(colIndex, rowIndex);

    //Got error in following line******
    var val = ce.field.store.getById(value).get("name");
    return val;
    }


    Combo boxes are loading data correctly based on id, but I think there could be memory issue as I am creating new combo boxes in every row. And the custom render function is not working. It's just displaying id instead of values. Is there any better and correct way to handle this?

    Thank you.


  • The ideal would be if you could:

    a) deliver data for display together with main grid data so you wouldn't need any custom renderer

    b) use only one combo loading its store depending on what is being edited; user cannot edit more than one field at a time anyway







  • #If you have any other info about this subject , Please add it free.#
    Your name:
    E-mail:
    Telphone:

    Your comments:


    If you have any other info about EditorGrid and different combo boxes , Please add it free.