jQWidgets Forums

Forum Replies Created

Viewing 1 post (of 1 total)
  • Author
    Posts
  • in reply to: Grid aggregatesrenderer Grid aggregatesrenderer #120441

    iangwatts
    Participant

    I know this one is old, but … I am getting a javascript fail in the microsoftajax logic when I try to apply an aggregatesrenderer to a column that has no values (they are all null). Apart from catching the nulls before they are sent to the dataadaptor (on the server side) there doesn’t seem to be a way to catch them on the client side. Note that I can aggregate, and I get “Sum:NaN”. However, if I override the renderer it bugs out in Microsoftajax. If at least one value is non-null then it gets to the aggregatesrenderer function. Code snippet is:
    {
    text: ‘Total Budget (‘ + self.OrganisationCurrency + ‘)’, datafield: ‘TotalBudget’, width: 120, cellsalign: ‘right’, align: ‘right’, cellsformat: ‘d2’,
    cellsrenderer: self.moneyRenderer, aggregates: [‘sum’], aggregatesrenderer: self.aggMoneyRenderer
    },

    FWIW here is the renderer code. Note that it doesn’t make it to this function on the column in question.
    self.aggMoneyRenderer = function (aggregates) {
    var ag = aggregates[‘sum’] || ‘0’; // not sure why the renderer needs to send the value as a string – so we need to parse it …
    var sum = parseFloat(ag.replace(/,/g, ”))
    return ‘<div class=”grid-div” style=”text-align: right; margin-top: 4px;”><span>’ + self.moneyFormatter.format(sum) + ‘</span></div>’;
    };

Viewing 1 post (of 1 total)