jQWidgets Forums

Forum Replies Created

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts

  • bcurr
    Participant

    You assumed correctly.
    I’ll give your suggestions a go. Many thanks!


    bcurr
    Participant

    That makes sense that it would loop.
    Is there a better place to do this calculated than cellrenderer then?


    bcurr
    Participant

    A 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


    bcurr
    Participant

    Dimitar, 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 row2

    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);
            return '<span style="margin: 4px; float: ' + columnproperties.cellsalign + ';">' + (parseFloat(row0) * parseFloat(row2)) + '</span>';
        }
    }

    Again, many thanks for the help!

Viewing 4 posts - 1 through 4 (of 4 total)