3
votes

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.

1
I think you are going to want to keep a reference to the second window and use component query to find the text field. Then use the setValue() function to set the value, or create a form on that window and use loadRecord() on that form. In any case, a jsFiddle or just more code would be needed to give a better answer.Stephen Tremaine

1 Answers

1
votes

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.