Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Matt on Mar 18, 2009 10:25
open dhtmlx forum
DHTMLXGrid and Combo - load the cell combo using other columns in the grid as parameters

Hi,

I'm sure this has been asked before but I cannot find any reference to it.

I have a grid which contains a number of columns:
4 of these are "weight"," height","length" and "width".
I have another column which displays a list of delivery services in a combo box.

In this combo I need to only show the services for a given "weight"," height","length" and "width". In other words the combo options depend on the values in the other 4 columns.

What is the best way to do this?

many thanks
Answer posted by Alex (support) on Mar 19, 2009 03:37

Hello, 

You can use onEditCell event handler. When the value in one of the described columns changes, the combo in the last column and in the same row must be reloaded with new values.

In case of using "combo" excell:

grid.attachEvent("onEditCell",function(stage,id,index){

if(index !=4){

var combo = grid.cells(id,4).getCellCombo();

combo.clearAll();

combo.loadXML(url+"?weight="+grid.cells(id,0).getValue()+"&height="+grid.cells(id,1).getValue()+...);

}

return true

}) 

Answer posted by Matt on Mar 19, 2009 06:26

Hi

Thanks for your very quick reply - I'm getting the following result in firebug

mygrid.cells(rowID, 10).getCellCombo is not a function
 
" var combo = mygrid.cells(rowID,10).getCellCombo();"

 

I'm using the Pro code - Have I included all the right code as listed below?

<script src="dhtmlx/dhtmlxGridPro/codebase/dhtmlxcommon.js"></script>
<script src="dhtmlx/dhtmlxGridPro/codebase/dhtmlxgrid.js"></script>
<script src="dhtmlx/dhtmlxGridPro/codebase/dhtmlxgridcell.js"></script>
<script src="dhtmlx/dhtmlxGridPro/codebase/ext/dhtmlxgrid_excell_combo.js"></script>

<script src="dhtmlx/dhtmlxcomboPro/codebase/dhtmlxcombo.js"></script>
<script src="dhtmlx/dhtmlxcomboPro/codebase/ext/dhtmlxcombo_extra.js"></script>
<script src="dhtmlx/dhtmlxcomboPro/codebase/ext/dhtmlxcombo_group.js"></script>
<script src="dhtmlx/dhtmlxcomboPro/codebase/ext/dhtmlxcombo_whp.js"></script>

<link rel="STYLESHEET" type="text/css" href="dhtmlx/dhtmlxcomboPro/codebase/dhtmlxcombo.css">

Answer posted by Alex (support) on Mar 19, 2009 08:16

Hello, 

Please, check the type of the 11th column is "combo". 

There is an issue in the provided code:

please, try to use 

if((index !=4) && (stage == 0)){

instead of

if(index !=4){

If problem persists, please, provide the sample to reproduce the issue  (wihthout grid libraries files)

Answer posted by Matt on Mar 20, 2009 06:37
Thank you for help with resolving this. it is now working thaks to you