jQuery UI Widgets Forums Grid Localization of 'contains' in inputfilter->wrong default-filtercondition

This topic contains 7 replies, has 5 voices, and was last updated by  admin 3 years, 1 month ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author

  • ca
    Participant

    Hi,

    I’m having problems with the localization of the filterstringcomparisonoperators.
    Usually the comparison operator ‘contains’ is selected by default but as soon as the displayed name of the operator is changed (e.g. to ‘contain’) the comparison operator ’empty’ is selected by default (resulting in strange behavior of the table).

    I have modified one of your examples to illustrate the problem:

    <div id='jqxWidget'>
        <div id="jqxgrid"></div>
    </div>
     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";
         localizationobj.filterstringcomparisonoperators= ['empty', 'not empty', 'contain', 'contains(match case)',
                            'does not contain', 'does not contain(match case)', 'starts with', 'starts with(match case)',
                            'ends with', 'ends with(match case)', 'equal', 'equal(match case)', 'null', 'not null'];
         return localizationobj;
     }
     $("#jqxgrid").jqxGrid({
         theme: 'energyblue',
         width: 500,
         source: dataAdapter,
         showfilterrow: true,
         filterable: true,
         pageable: true,
         autoheight: true,
         editable: true,
         localization: getLocalization(),
         selectionmode: 'singlecell',
         columns: [{
             text: 'Name',
             columntype: 'textbox',
             filtertype: 'input',
             datafield: 'name',
             width: 115
         }, {
             text: 'Produkt',
             filtertype: 'input',
             datafield: 'productname',
             width: 220
         }, {
             text: 'Datum',
             datafield: 'date',
             columntype: 'datetimeinput',
             filtertype: 'date',
             width: 210,
             cellsalign: 'right',
             cellsformat: 'd'
         }, {
             text: 'Qt.',
             datafield: 'quantity',
             columntype: 'numberinput',
             filtertype: 'textbox',
             cellsalign: 'right',
             width: 60
         }, {
             text: 'Preis',
             datafield: 'price',
             columntype: 'numberinput',
             filtertype: 'textbox',
             cellsformat: "c2",
             cellsalign: 'right'
         }]
     });

    As a workaround i tried to initialize the columns with
    filtercondition: 'contains'
    But as soon as a filter was added to and removed from that column the default-value of the filtercondition is set to ’empty’ again.
    It seems that somewhere in the jqwidgets-code the filtercondition ‘contains’ is hard-coded as default-value and if the filterstringcomparisonoperators does not contain the value ‘contains’ it just sets the default filtercondition to the first element.
    Could you please provide a suitable workaround for this problem and/or fix this issue in one of the next versions?

    Best regards,
    ca


    Peter Stoev
    Keymaster

    Hi ca,

    As a solution you can put another filtertype if you wish, like “textbox”, or leave the selection as it is.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com


    ca
    Participant

    Hi Peter,

    thanks for the quick reply, but this isn’t really the response i was hoping for.
    What you are saying effectively means that the filtertype ‘input’ does not work correctly if the filterstringcomparisonoperators are localized.
    Will this bug be fixed? (and if yes, when?)

    Best Regards,
    ca


    Peter Stoev
    Keymaster

    Hi ca,

    I do not think that I wrote something like that. You have options to choose from if you don’t like the designed behavior of this filter widget.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com


    ca
    Participant

    Hi Peter,

    could you please try out the example i posted above? (I just adapted this example http://jsfiddle.net/jqwidgets/ENbB6/)
    As soon as the ‘contains’-operator is localized, all the filters in the table become completely unusable.
    When something is entered in any filter of the table the filters with filtertype input become active (hiding all table rows that are not empty).
    I don’t think this is the designed behavior of the widget, it’s plainly a bug that needs to be fixed.

    Best Regards,
    ca


    ymiraola
    Participant

    Hello everyone,

    I’m having the same problem when ‘contains’ is translated.
    I realize that these posts are quite old. Is someone working on this issue?

    Any help will be appreciated.
    Best regards, ymiraola.


    totrebor
    Participant

    Hello everyone,
    I’m having the same problem when ‘contains’ is translated.

    Any help will be appreciated.
    Best regards, totrebor.


    admin
    Keymaster

    Hi totrebor,

    Could you please, share an example about that. Jsfiddle or CodePen which uses the latest version of jqxGrid?

    Best regards,
    Peter Stoev

    jQWidgets Team
    https://www.jqwidgets.com/

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

You must be logged in to reply to this topic.