change cell from ed to combo on the fly

Hi,

I have the professional version of xgrid which has lots of dropdowns. at present the contents of the dropdowns are populated on the fly at stage 0 of oneditcell using combo.loadxml. The problem is this is still a bit slower than I would like because so many combo objects are being created when the page first loads.

I had good success using the setCellExcellType command to speed up pageloads for date fields by loading the column firstly just as an ed type and then changing them into a dhxcalendar object on the fly when they were clicked on. my problem is when i use this same approach by trying to turn an ‘ed’ type cell into a combo on the fly using;

mygrid.setCellExcellType(rowId,cInd,“combo”);

i get this.combo.DOMParent is null or not an object. The error I think is not created when running the above command, but when you try to then edit the cell after - ie. the type has changed, but the combo object has not been properly created.

I understand I may need to add some extra code to turn an ed cell into a combo but I have no idea how to do this. Can you please advise how I can go about this?

cheers;
Michael.

Hello,

onEditCell event is too late to change cell type. The cell type should be set before editing is started:

mygrid.loadXML(url,function(){ mygrid.setColumnExcellType(columnIndex,"combo"); /*or you may call forEachRow method to define the cells that should have combo type*/ mygrid.forEachRow(function(rowId){ if(....) mygrid.setCellExcellType(rowId,columnIndex,"combo"); ) }); mygrid.attachEvent("onEditCell",function(stage,rowId,cInd){ if(stage == 0){ if(....){ var combo = mygrid.cells(rowId,cInd).getCellCombo(); combo.loadXML(url); } } return true })

Hi,

thanx for the suggestion.

i was getting around oneditcell being too late by changing the celltype, then before returning false, scheduling a select and editcell function using ontimeout to kick in after 250millisec. this works for all other cell types eg. ed to dhxcalendar, but not for ed to combo, nor even for co to combo or coro to combo.

however… i thought i tried using ‘setColumnExcellType’ previously, but must have done something wrong because i retried it based on your suggestion and can now get at least whole columns to turn from ed to combo on the fly, but still get the same “this.combo.DOMParent is null or not an object” error when trying to change just a single cell.

not that its so much of a big deal anymore (now that I can at least change an entire column on the fly which definately speeds up page-load times which was the complaint i was getting from my users) i’m still curious, is it at all possible to even have a single cell (whether changed on the fly or pre-loaded) as a combo when the rest of the column isnt?

cheers;
Michael.