jQWidgets Forums
Forum Replies Created
Viewing 4 posts - 1 through 4 (of 4 total)
-
Author
-
July 14, 2014 at 9:26 am in reply to: Calculated Row Based on Other Rows Calculated Row Based on Other Rows #57151
You assumed correctly.
I’ll give your suggestions a go. Many thanks!July 14, 2014 at 7:58 am in reply to: Calculated Row Based on Other Rows Calculated Row Based on Other Rows #57146That makes sense that it would loop.
Is there a better place to do this calculated than cellrenderer then?July 13, 2014 at 6:15 pm in reply to: Calculated Row Based on Other Rows Calculated Row Based on Other Rows #57133A follow on question if I may. Is there a reason why during the above code I cannot do a setcellvalue?
eg.cellsrenderer = function (row, columnfield, value, defaulthtml, columnproperties, rowdata) { if (row == 3) { var row0 = $('#jqxgrid').jqxGrid('getcellvalue', 0, columnfield); var row2 = $('#jqxgrid').jqxGrid('getcellvalue', 2, columnfield); var row_calc = parseFloat(row0*row2); return '<span style="margin: 4px; float: ' + columnproperties.cellsalign + ';">' + row_calc + '</span>'; $("#jqxgrid").jqxGrid("setcellvalue", 3, columnfield, row_calc); } }
When I try it and debug in Chrome I get “Uncaught RangeError: Maximum call stack size exceeded”
The reason I’m trying to do this is the total column is calculated on A+B+C+D etc
July 13, 2014 at 12:19 pm in reply to: Calculated Row Based on Other Rows Calculated Row Based on Other Rows #57122Dimitar, thank you so much for this it worked fantasticly.
To make it easier, I used columnfield instead of “A”. “B” etc.
I’ve also updated the code below to reflect row0 and row2cellsrenderer = function (row, columnfield, value, defaulthtml, columnproperties, rowdata) { if (row == 3) { var row0 = $('#jqxgrid').jqxGrid('getcellvalue', 0, columnfield); var row2 = $('#jqxgrid').jqxGrid('getcellvalue', 2, columnfield); return '<span style="margin: 4px; float: ' + columnproperties.cellsalign + ';">' + (parseFloat(row0) * parseFloat(row2)) + '</span>'; } }
Again, many thanks for the help!
-
AuthorPosts
Viewing 4 posts - 1 through 4 (of 4 total)