PDA

View Full Version : Use regular html form elements in grid cell?



JKralicky
4 Oct 2007, 10:05 AM
Hi gang,
I'm trying to render a grid with html form fields in a grid cell. I want the form fields to always be visible, and I want to use my own HTML, not an Ext editor type. My ajax service sends me the HTML form data and I just render it. There are multiple form fields in a single cell.
I basically want a no nonsense data grid that displays what I put in it.

I can send HTML into the cell (on an EditorGrid, because a regular Grid gives me javascript errors) but I am having trouble focusing on text areas (cursor gets lost) and selecting pulldowns. How do I override whatever events are causing the trouble?

please help!
Thanks!
Joe

JKralicky
5 Oct 2007, 2:20 PM
I've tried everything I can think of to get this to work... Still no luck.
Any ideas aside from not using the Ext grid?

Thanks!
Joe

JKralicky
23 Oct 2007, 6:37 AM
I was able to extend the cell selection model so that the html form fields that I use in the grid cell are selectable and usable. Here's what I did:


// create a new Cell Selection class
Ext.ux.NoFocusCellSelectionModel = function(config) {
Ext.ux.NoFocusCellSelectionModel.superclass.constructor.call(this,config);

};

Ext.extend(Ext.ux.NoFocusCellSelectionModel, Ext.grid.CellSelectionModel, {
select : function(rowIndex, colIndex, preventViewNotify, preventFocus, r){
// override these two properties so the row doesn't get selected.
preventViewNotify = true;
preventFocus = true;
Ext.ux.NoFocusCellSelectionModel.superclass.select.call(this, rowIndex, colIndex, preventViewNotify, preventFocus, r);
}

});


... and when creating the grid, set the selModel to this new model:



theGrid = new Ext.grid.EditorGrid('my_div', {
ds: theDataStore,
cm: theColModel,
autoExpandColumn: 'condition',
enableDragDrop: false,
enableColumnMove: false,
trackMouseOver: false,
enableColLock:false,
selModel: new Ext.ux.NoFocusCellSelectionModel
});



I hope this helps someone!
*note: text fields are missing the cursor in Firefox, but still work.

Joe