jQuery UI Widgets Forums Grid Aggregates ignoring localization?

This topic contains 3 replies, has 3 voices, and was last updated by  anticCreations 7 years, 9 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • Aggregates ignoring localization? #29859

    creativehead
    Member

    Hello out there,

    I have a jqxGrid with german localization and used to change currency to € instead of $. This all works fine for the cells but the aggregate still shows $. I could go around that with a custom aggregate rendering function but I think it should work out of the box?

    any suggestions? do I miss something to set up to let it work correctly?

    bR
    Michael

    Aggregates ignoring localization? #29878

    Peter Stoev
    Keymaster

    Hi Michael,

    We cannot reproduce that with the latest version of our software.

    Example is below:

    <!DOCTYPE html>
    <html lang="en">
    <head>
    <title id='Description'>This example illustrates the Grid filtering feature. Enter some data into the Filter Row.</title>
    <link rel="stylesheet" href="../../jqwidgets/styles/jqx.base.css" type="text/css" />
    <script type="text/javascript" src="../../scripts/jquery-1.10.2.min.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxcore.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxdata.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxbuttons.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxscrollbar.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxlistbox.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxdropdownlist.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxmenu.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxgrid.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxgrid.filter.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxgrid.sort.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxgrid.edit.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxgrid.aggregates.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxgrid.selection.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxpanel.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxcalendar.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxdatetimeinput.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxgrid.pager.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxnumberinput.js"></script>
    <script type="text/javascript" src="../../scripts/gettheme.js"></script>
    <script type="text/javascript" src="../../jqwidgets/globalization/globalize.js"></script>
    <script type="text/javascript" src="generatedata.js"></script>
    <script type="text/javascript">
    $(document).ready(function () {
    var theme = getDemoTheme();
    var data = generatedata(250);
    var source =
    {
    localdata: data,
    datafields:
    [
    { name: 'name', type: 'string' },
    { name: 'productname', type: 'string' },
    { name: 'available', type: 'bool' },
    { name: 'date', type: 'date'},
    { name: 'quantity', type: 'number' },
    { name: 'price', type: 'number' }
    ],
    datatype: "array"
    };
    var dataAdapter = new $.jqx.dataAdapter(source);
    var getLocalization = function () {
    var localizationobj = {};
    localizationobj.pagergotopagestring = "Gehe zu:";
    localizationobj.pagershowrowsstring = "Zeige Zeile:";
    localizationobj.pagerrangestring = " von ";
    localizationobj.pagernextbuttonstring = "voriger";
    localizationobj.pagerpreviousbuttonstring = "nächster";
    localizationobj.sortascendingstring = "Sortiere aufsteigend";
    localizationobj.sortdescendingstring = "Sortiere absteigend";
    localizationobj.sortremovestring = "Entferne Sortierung";
    localizationobj.firstDay = 1;
    localizationobj.percentsymbol = "%";
    localizationobj.currencysymbol = "€";
    localizationobj.currencysymbolposition = "after";
    localizationobj.decimalseparator = ".";
    localizationobj.thousandsseparator = ",";
    var days = {
    // full day names
    names: ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"],
    // abbreviated day names
    namesAbbr: ["Sonn", "Mon", "Dien", "Mitt", "Donn", "Fre", "Sams"],
    // shortest day names
    namesShort: ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"]
    };
    localizationobj.days = days;
    var months = {
    // full month names (13 months for lunar calendards -- 13th month should be "" if not lunar)
    names: ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember", ""],
    // abbreviated month names
    namesAbbr: ["Jan", "Feb", "Mär", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dez", ""]
    };
    var patterns = {
    d: "dd.MM.yyyy",
    D: "dddd, d. MMMM yyyy",
    t: "HH:mm",
    T: "HH:mm:ss",
    f: "dddd, d. MMMM yyyy HH:mm",
    F: "dddd, d. MMMM yyyy HH:mm:ss",
    M: "dd MMMM",
    Y: "MMMM yyyy"
    }
    localizationobj.patterns = patterns;
    localizationobj.months = months;
    localizationobj.todaystring = "Heute";
    localizationobj.clearstring = "Löschen";
    return localizationobj;
    }
    $("#jqxgrid").jqxGrid(
    {
    width: 685,
    source: dataAdapter,
    showfilterrow: true,
    filterable: true,
    pageable: true,
    showstatusbar: true,
    showaggregates: true,
    autoheight: true,
    editable: true,
    theme: theme,
    localization: getLocalization(),
    selectionmode: 'singlecell',
    columns: [
    { text: 'Name', columntype: 'textbox', filtertype: 'textbox', datafield: 'name', width: 115 },
    { text: 'Produkt', filtertype: 'textbox', datafield: 'productname', width: 220 },
    {text: 'Datum', datafield: 'date', columntype: 'datetimeinput', filtertype: 'date', width: 210, cellsalign: 'right', cellsformat: 'd'},
    { text: 'Preis', datafield: 'price', columntype: 'numberinput', filtertype: 'textbox', aggregates: ['sum'], cellsformat: "c2", cellsalign: 'right' }
    ]
    });
    });
    </script>
    </head>
    <body class='default'>
    <div id="jqxgrid">
    </div>
    </body>
    </html>

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Aggregates ignoring localization? #30000

    creativehead
    Member

    In my sample I did this and for aggregates it fails:
    $(“#jqxgrid”).on(‘bindingcomplete’, function() {
    $(“#jqxgrid”).jqxGrid(‘localizestrings’, getLocalization());
    });
    (don’t ask me why I did not use the suggested method)

    now added localization: getLocalization() into the Grid setup and it works fine

    thanks

    Aggregates ignoring localization? #86932

    anticCreations
    Participant

    Hi Peter,
    if I follow your example, then the aggregates result ‘Sum’ is not translated ( in this case into germam).
    How or what are the terms for the aggregates ( count, sum etc ) to be translated in the localizatin file?

    regards

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

You must be logged in to reply to this topic.