Categories | Question details Back To List | ||
selectbox (coro) issue with paste from excel When I paste data from Excel, even if the data is not in the list, it copies it in the coro field. I would like to have the cell empty if the copied value is not a valid one (not in the current list of value). How this could be done? Answer posted by Support on Jan 07, 2009 15:29 Unfortunately such behavior can be changed only with code modification. Please inform if such way of solution will work for you - we will provide more detail about which code and in which way may be changed to adjust to your needs. Technically , grid has onCellChanged event, which called each time when cell value changed and can be used for your needs , but it will slowdown data loading a lot grid.attachEvent("onCellChanged",function(id,ind,value){ if (ind==INDEX_OF_CORO && value!=ALLOWED_ONE) this.cells(id,ind).setValue(""); }); Answer posted on Jan 08, 2009 06:16 thank you, here is what I use for value!=allowed_one function isInArray(needle, arrayHaystack) and call it this way: isInArray(value,mygrid.getCombo(ind).getKeys())) any better solution?
Answer posted by Support on Jan 08, 2009 10:02 To make it faster you can use object instead of array var check={ "value1":true, "value2":true, "value3":true } if (check[value]) do_some(); such kind of checking will be few times faster >>isInArray(value,mygrid.getCombo(ind).getKeys())) can be based on built in methods as if (mygrid.getCombo(ind).keys._dhx_find(value)!=-1) do_some(); |