Categories | Question details Back To List | ||
dhtmlxGrid - how to add combox to a grid through addRow method I am new to this dhtmlx space.. i went through other posts and found few ways of populating the combobox. but still i am not clear how to add it through addRow method. If i am not wrong, we can add values for the combobox as follows - assuming i hv four columns and third column is a checkbox and the last column is simple selectbox(type "coro") mygrid.addHeader("Col1,Col2,Col3,Col4"); mygrid.setColTypes("ro,ro,ch,coro"); var z = mygrid.getCombo(columnIndex); z.put("key",value") mygrid.addRow(1,['xxx','xxx','0',?],1); what should i put in the place of ? in the above addRow method? and how do i set the state of selectbox. Kindly help me out at the earliest Answer posted by Support on Mar 12, 2008 08:48 You need to provide the "key" as value of addRow command, grid will locate related value and render its in HTML view. If there is no value related to key , key will be used as value. mygrid.addRow(1,['xxx','xxx','0','key'],1); => xxx | xxx | 0 | value mygrid.addRow(1,['xxx','xxx','0','not_existing_key'],1); => xxx | xxx | 0 | not_existing_key >>and how do i set the state of selectbox. In any moment of time you can set value of cell by In case of selectbox (co|coro) grid.cells(i,j).setValue('key'); == > will render 'value' in HTML grid.cells(i,j).setValue('not_existing_key'); == > will render 'not_existing_key' in HTML Answer posted by shrishti on Mar 12, 2008 23:34 thanks for the sooner response. 1. By 'state of the selectbox', i meant, how to enable or disable the selectbox? 2. if we add values to the combo as specified earlier, the whole column contains the same list of values in the combo. I need to have different values in each row. Can this be done? Waiting for ur response. thanks.. Answer posted by shrishti on Mar 13, 2008 01:02 adding to the above, i found tht combobox.getCustomCombo(rowId,colIndex) can be used to have different values in each row. But I guess this is available only with the latest edition. if i use the pro edition js, i get a javascript error "_isIE undefined"..what to do? Answer posted by shrishti on Mar 13, 2008 02:28 sorry..tht script error was due to my mistake..i missed a script file to be included. getCustomCombo() worked fine. I am just not able to figure out how to enable or disable combobox Answer posted by Support on Mar 13, 2008 02:33 >>1. By 'state of the selectbox', i meant, how to enable or disable the selectbox? If you need to disable|enable for some specific cell grid.cells(i,j).setDisabled(true); grid.cells(i,j).setDisabled(false); >>2. if we add values to the combo as specified earlier, the whole column contains the same list of values in the combo. I need to have different values in each row. Can this be done? Supported starting from dhtmlxgrid 1.5 mygrid.addRow(1,['xxx','xxx','0',?],1); var z = mygrid.getCustomCombo(1,columnIndex); // 1 - row ID z.put("key1",value1") // values specific for row 1 , will not be shown for any other row >> if i use the pro edition js, i get a javascript error "_isIE undefined"..what to do? This is pretty strange because _isIE global constant which must be available with any version of grid, please be sure that while including js files in page dhtmlxcommon.js included before other files. If necessary I can provide code of getCustomCombo method it can be incorporated in previous version of grid ( 1.4 ) Answer posted by shrishti on Mar 13, 2008 02:54 state of a selecbox is working fine..thanks.. |