PDA

View Full Version : How to pass cell value to ext window from an editgrid?



derekc
14 Sep 2010, 1:24 PM
This is far from pretty, but I am listening to the cellclick on an editgrid to create a new ext window (on the first click, and reposition the window on subsequent clicks). I'm wondering if/how I can populate the textarea of this ext window based on another hidden column in the same row and save the result back.



listeners: {
cellclick: function(grid, rowIndex, colIndex, e) {
if (!win) {
win = new Ext.Window({
closeAction: 'hide',
height: 300,
width: 300,
x: Ext.get(e.getTarget()).getX(),
y: Ext.get(e.getTarget()).getY(),
layout: 'form',
defaultType: 'field',
items: [
{ xtype: 'textarea', fieldLabel: 'notes' }
]
})
win.show();
}
else {
win.hide();
win.x = Ext.get(e.getTarget()).getX();
win.y = Ext.get(e.getTarget()).getY();
win.show();
}
}
}


I've also considered creating a cell template with a reference to an ext window that will show/hide based on cell validation... still very new to ExtJS so I'm not sure what the best approach would be.

Any advice, suggestions or comments would be appreciated.
Thanks in advance,
Derek

derekc
14 Sep 2010, 2:22 PM
To document my progress. The next step was being able to update text inside the ext window.

On my definition item definition during the panel creation I needed to add a ref config to the textarea


{ xtype: 'textarea', ref: 'notes', fieldLabel: 'notes' }

Then I was able to set the value like:


win.notes.setValue('test12312312321');


Next step will be to get a value from elsewhere in the same row and handle an update on window close.

derekc
15 Sep 2010, 7:02 AM
The following post helped me update another cell in the same row:

http://www.sencha.com/forum/showthread.php?101277-How-to-set-value-in-grid-cell-on-change-event-in-another-cell&highlight=editgrid