jQWidgets Forums

Forum Replies Created

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

  • xixo
    Participant

    Thanks for the tip.

    Just put it on cellsrenderer, like this:

    var dataAdapter = dataAdaptersourceanlevofam;
        var cellclassname = function (row, column, value, data) {
            if (data.nome != "") {
                return "grayline";
            };
        };
        $("#jqxgridanl").jqxGrid({
            source: dataAdaptersourceanl,
            theme: 'Metro',
            height: 600,
            width: '100%',
            sortable: true,
            columnsresize: true,
            showaggregates: false,
            showstatusbar: true,
            statusbarheight: 25,
            altrows: false,
            showtoolbar: true,
            columns: [
                        { text: 'Family', dataField: 'family', width: 240, sortable: false, cellclassname: cellclassname },
                        { text: 'Year', dataField: 'year', width: 50, sortable: false, cellclassname: cellclassname },
                        { text: 'M1', dataField: 'm1', width: 110, align: 'right', cellsalign: 'right', sortable: false, cellclassname: cellclassname, cellsrenderer: function (row, column, value) {
                                var valor = $("#jqxgridanlevofam").jqxGrid('getcellvalue', row,'ano');
    
                                if (valor != 'Evo') {
                                    value = $.jqx.dataFormat.formatnumber(value, 'c0');
                                }
                                else 
                                {
                                    value = $.jqx.dataFormat.formatnumber(value, 'p2');
                                }
    
                                return '<span style="margin: 4px; float: right;">' + value + '</span>';}
            ]
        });

    But now I’ve got another problem, which is the currency format.
    Usually I put:

    var localizationobj = {};
    localizationobj.currencysymbol = " €";
    localizationobj.currencysymbolposition = "after";
    $("#jqxgridanl").jqxGrid('localizestrings', localizationobj);

    after creating the grid, but now it doesn’t work as it allways puts the “$” character.

    Thanks.


    xixo
    Participant

    Thank you very much…
    This is what I needed.


    xixo
    Participant

    Please close this question.

    Just made it working.

    I had $("#jqxgridanl").jqxGrid('updatebounddata');
    Passed to $("#jqxgridanl").jqxGrid('updatebounddata', 'cells');

    Thanks.

    in reply to: aggregates text aggregates text #85888

    xixo
    Participant

    Ok.

    Just tested the example given in the demo page, and the error is the same.
    Here’s my code:

    var estruct = {
        datafields: [
            { name: 'name', type: 'string' },
            { name: 'ly', type: 'decimal' },
            { name: 'lyytd', type: 'decimal' },
            { name: 'rdg', type: 'decimal' }
        ]
    };
    
    var sourceanl = estruct;
    
    var dataAdaptersourceanl = new $.jqx.dataAdapter(sourceanl);
    
    function createanl() {
        $("#jqxgridanl").jqxGrid({
            source: dataAdaptersourceanl,
            theme: 'Metro',
            height: 600,
            width: '100%',
            sortable: true,
            columnsresize: true,
            showaggregates: true,
            showstatusbar: true,
            statusbarheight: 25,
            altrows: true,
            showtoolbar: true,
            columns: [
                        { text: 'Name', dataField: 'name', width: 150 },
                        { text: 'LY', dataField: 'ly', width: 110, align: 'right', cellsalign: 'right', cellsformat: 'c0'
                            , aggregates: [{
                                '':
                                 function (aggregatedValue, currentValue, column, record) {
                                     return aggregatedValue + currentValue;
                                 }
                            }]
                        },
                        { text: 'LYYTD', dataField: 'lyytd', width: 110, align: 'right', cellsalign: 'right', cellsformat: 'c0'
                            , aggregates: [{
                                '':
                                 function (aggregatedValue, currentValue, column, record) {
                                     return aggregatedValue + currentValue;
                                 }
                            }]
                        },
                        {
                            text: 'R/D/G', dataField: 'rdg', width: 110, align: 'right', cellsalign: 'right', cellsformat: 'c0'
                            , aggregates: ['sum', 'avg']
                            , aggregatesrenderer: function (aggregates, column, element, summaryData) {
                                var renderstring = "<div class='jqx-widget-content jqx-widget-content-Metro' style='float: left; width: 100%; height: 100%;'>";
                                $.each(aggregates, function (key, value) {
                                    var name = key == 'sum' ? 'Sum' : 'Avg';
                                    var color = 'green';
                                    if (key == 'sum' && summaryData['sum'] < 650) {
                                        color = 'red';
                                    }
                                    if (key == 'avg' && summaryData['avg'] < 4) {
                                        color = 'red';
                                    }
                                    renderstring += '<div style="color: ' + color + '; position: relative; margin: 6px; text-align: right; overflow: hidden;">' + name + ': ' + value + '</div>';
                                });
                                renderstring += "</div>";
                                return renderstring;
                        }
                    ]
        });
    
        var localizationobj = {};
        localizationobj.currencysymbol = " €";
        localizationobj.currencysymbolposition = "after";
        $("#jqxgridanl").jqxGrid('localizestrings', localizationobj);
    
    }

    Thanks.

    in reply to: aggregates text aggregates text #85865

    xixo
    Participant

    Hello.

    When I try the given example I get this message:

    Uncaught Sys.ParameterCountException: Sys.ParameterCountException: Parameter count mismatch.

    Any ideas? Thanks.

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