Вопрос

I have created ExtJs window that displays grid with information retrieved from database. Now I have to add event double click on datagrid row, which I did. The problem that I have is on this event I open another window which contains input field and I have to add value in it from the clicked row in the grid.

Here is code snippet from the listener on double click:

listeners : {
     itemdblclick: function(dv, record, item, index, e) {
           _restoreCallsWindow().show(); //show the second window
           Ext.get("sense-restore-calls-path-textfield-bodyEl").child('.x-form-text').set({value:record.data.path}, true); //get the input field and add value
        }
}

The code above works OK, when I inspect the element in firebug has value attribute with the information from the grid, but I want to display this value in the input field. How can I do that?

Can you please share your knowledge?

Thanks.

Это было полезно?

Решение

I guess you have a Ext.form.Panel within the window then you only need to do the following:

listeners : {
    itemdblclick: function(dv, record, item, index, e) {
        var win = _restoreCallsWindow(),
            field= win.down('textfield'); // assuming you have just one textfield
        field.setValue(record.get('path'));
    }
}

Please note that the name property of each field must match the property name of the record. Other wise this won't work.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top