Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by kewi on Apr 28, 2009 02:11
open dhtmlx forum
Passing string value to math formula

Hi

I need to pass a value from a gridcolumn with strings to an own custom javascript formula, but if I try to pass it as a cx value (c8) it is recieved as a NaN. Is it possible to write it in any other form then c8 to get the string value insted of a, I guess, parsed number ?
(have pro version)
Answer posted by dhxSupport on Apr 28, 2009 05:17

You can change formula in the grid's column using setValue() method: mygrid.cellByIndex(2,3).setValue('=c8'); If you want get math formula from the particular cell you can store it in the cell's attribute:

Answer posted by Support on Apr 28, 2009 14:21
>>is it possible to write it in any other form then c8 to get the string value
Unfortunately it not possible without code modification (all data forcefully converted to numbers during math operation )

dhtmlxgrid_math.js , line  226

return "(agrid.cells(\""+id+"\","+$1+").getValue()*1)";

just remove "*1" at the end of line to prevent conversion to numbers ( beware that it can cause problems for normal math operations )

Answer posted by kewi on Apr 29, 2009 02:19
Thx. I found that part in the code. Was thinking about adding a new parameter type s insted of c that returns a string. But i dont really want to like to mess with your code, I'll have to remember to redo it when updates come.