yavalvas
yavalvas

Reputation: 330

How to create cell editor for speciall cell in grid with another grid and selection of value from it in ExtJs?

I'm trying to create editor with grid and now I have such variant:

var panelWithGrid = Ext.create('Ext.grid.Panel', {
    store: cellEditorGridStore,
    autoScroll: true,
    width: 300,
    height: 200,
    sortable: true,
    title: "My Editor",
    ...
    columns: [
        {
            dataIndex: "first",
            width: "13%",
            text: "First"
        },
        {
            dataIndex: "second",
            width: "87%",
            text: "Second"
        }
    ],
    bbar: [
        {
            xtype: "button",
            text: "change value of cell",
            handler: function(){
                //close action + inserting of selected value from one grid to another?
            }
        },
        {
            xtype: "button",
            text: "close editor",
            handler: function(){
                //normal close action? tried to hide, that works bad.
            }
        }
    ]
});
var myOwnCellEditor = Ext.create('Ext.grid.CellEditor', {
    autoCancel: true,
    closeAction: 'hide',
    field: panelWithGrid
});

Moreover I created another grid with getEditor attribute in one of all columns

...
getEditor: function(record){
    if(record.raw.myColumnIndex==="gridEditor"){
        Ext.Ajax.request({
            ...
            async: false,
            success: function(response, options){
                ...//downloading of cellEditorGridStore
            }
    }
    return myOwnCellEditor;
}

So I have a number of problems with such editor. When I click on cell to edit I have an error:

Uncaught TypeError: undefined is not a functionext-all.js:38 
Ext.define.startEditext-all.js:38 
Ext.define.showEditorext-all.js:38 
b

When I try to hide editor, it isn't shown correct the second time. Do you know a better way to implement such editor?

Upvotes: 1

Views: 217

Answers (1)

yavalvas
yavalvas

Reputation: 330

I've found another way to create widget for taking of value from other grid. I add to my grid

listeners: {
    cellclick: function(gridView,htmlElement,columnIndex,dataRecord){
        if(columnIndex == 1){
            if(dataRecord.data.second){
                ...
                //memorize current dataRecord to change value by using of
                //dataRecord.set("second", new_value) and show my grid-editor
            }
        }
    })
}

Such decision works quite good, but it's not editor.

Upvotes: 2

Related Questions