jQuery UI Widgets Forums Grid Default Filter Condition in Grid Filter Dropdown

This topic contains 6 replies, has 2 voices, and was last updated by  Sibeesh Venu 9 years, 2 months ago.

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

  • Sibeesh Venu
    Participant

    How Can I set ‘Equal’ as the default filter condition in grid, that is, when ever user clicks on filter icon, the first filter condition must be ‘Equal’. I am asking something like this.

    Kindest Regards
    Sibeesh Venu


    Peter Stoev
    Keymaster

    Hi Sibeesh,

    You need to implement the updatefilterpanel function. We have online demo – http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/filterconditions.htm?arctic

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com


    Sibeesh Venu
    Participant

    In that demo you are applying a default filter, I do not need to apply any filter, I just need that ‘Equal’ condition should come first in the drop down for all type of filter( String, numeric).


    Peter Stoev
    Keymaster

    Hi Sibeesh,

    In that demo we do many things one of which is to implement updatefilterpanel.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com


    Sibeesh Venu
    Participant

    Please be noted that I have already applied that.

    rendered: function () {
                    var localizationobj = {};
                    filterstringcomparisonoperators = ['empty', 'not empty', 'equal', 'contains', 'does not contain', 'starts with', 'ends with', 'null'];
                    filternumericcomparisonoperators = ['not equal', 'less than', 'equal', 'less than or equal', 'greater than', 'greater than or equal', 'null', 'not null'];
                    filterdatecomparisonoperators = ['not equal', 'less than', 'equal', 'less than or equal', 'greater than', 'greater than or equal', 'null', 'not null'];
                    filterbooleancomparisonoperators = ['equal', 'not equal'];
    
                    localizationobj.filterstringcomparisonoperators = filterstringcomparisonoperators;
                    localizationobj.filternumericcomparisonoperators = filternumericcomparisonoperators;
                    localizationobj.filterdatecomparisonoperators = filterdatecomparisonoperators;
                    localizationobj.filterbooleancomparisonoperators = filterbooleancomparisonoperators;
    
                    // apply localization.
                    $(openFrom + "#jqxgrid").jqxGrid('localizestrings', localizationobj);
                },
                updatefilterconditions: function (type, defaultconditions) {
                    var stringcomparisonoperators = ['EMPTY', 'NOT_EMPTY', 'EQUAL', 'CONTAINS', 'DOES_NOT_CONTAIN', 'STARTS_WITH', 'ENDS_WITH', 'NULL'];
                    var numericcomparisonoperators = ['NOT_EQUAL', 'LESS_THAN', 'EQUAL', 'LESS_THAN_OR_EQUAL', 'GREATER_THAN', 'GREATER_THAN_OR_EQUAL', 'NULL', 'NOT_NULL'];
                    var datecomparisonoperators = ['NOT_EQUAL', 'LESS_THAN', 'EQUAL', 'LESS_THAN_OR_EQUAL', 'GREATER_THAN', 'GREATER_THAN_OR_EQUAL', 'NULL', 'NOT_NULL'];
                    var booleancomparisonoperators = ['EQUAL', 'NOT_EQUAL'];
                    switch (type) {
                        case 'stringfilter':
                            return stringcomparisonoperators;
                        case 'numericfilter':
                            return numericcomparisonoperators;
                        case 'datefilter':
                            return datecomparisonoperators;
                        case 'booleanfilter':
                            return booleancomparisonoperators;
                    }
                }

    I have tried even changing the condition order, but still it is not working. Please check and help me.


    Sibeesh Venu
    Participant

    Sibeesh Venu
    Participant

    I have done it by adding

    updatefilterpanel: function (filtertypedropdown1, filtertypedropdown2, filteroperatordropdown, filterinputfield1, filterinputfield2, filterbutton, clearbutton,
                     columnfilter, filtertype, filterconditions) {
                    var index1 = 0;
                    var index2 = 0;
                    filtertypedropdown1.jqxDropDownList({ autoDropDownHeight: true, selectedIndex: index1 });
                    filtertypedropdown2.jqxDropDownList({ autoDropDownHeight: true, selectedIndex: index2 });
                }

    Thanks a lot for your help.

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

You must be logged in to reply to this topic.