jQWidgets Forums

jQuery UI Widgets Forums Grid How to create a custom filter with 'updatefilterconditions' function

This topic contains 1 reply, has 2 voices, and was last updated by  Peter Stoev 12 years, 1 month ago.

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

  • Michael Arrastia
    Participant

    Hello,

    I have read the Grid Filter page (http://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-filtering.htm) and am following the instructions detailed in the section ‘Custom Filter Conditions’.

    As explained in the page I have added the ‘updatefilterconditions’ function definition to the jqxGrid constructor object. However, this update function never gets called. Am I missing something?

    Here is the code I am using:

    // COPIED FROM JQXGRID CUSTOM FILTER CONDITIONS EXAMPLE
    gridParentElem.bind(‘bindingcomplete’, function () {
    var localizationobj = {};
    filterstringcomparisonoperators = [’empty’, ‘not empty’, ‘contains1’, ‘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’];
    filternumericcomparisonoperators = [‘equal’, ‘not equal’, ‘less than’, ‘less than or equal’, ‘greater than’, ‘greater than or equal’, ‘null’, ‘not null’];
    filterdatecomparisonoperators = [‘equal’, ‘not equal’, ‘less than’, ‘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.
    gridParentElem.jqxGrid(‘localizestrings’, localizationobj);
    });

    gridParentElem.jqxGrid({
    columns: columns,
    source: source,
    theme: ‘amdocs-search’,

    altrows: false,
    columnsheight: 56,
    columnsresize: true,
    columnsreorder: true,
    enableanimations: false,
    enablehover: false, // don’t highlight the row under the mouse pointer
    filterable: true,
    groupable: true,
    pageable: false,
    selectionmode: ‘multiplerows’,
    rowsheight: 34,
    width : ‘99.9%’, // ‘100%’
    height : ‘100%’,
    // enable multiple column sorting
    sortable: {
    mode: “multiple”,
    allowUnsort: true
    },

    // COPIED FROM JQXGRID CUSTOM FILTER CONDITIONS EXAMPLE
    updatefilterconditions: function (type, defaultconditions) {
    var stringcomparisonoperators = [‘EMPTY’, ‘NOT_EMPTY’, ‘CONTAINS’, ‘CONTAINS_CASE_SENSITIVE’,
    ‘DOES_NOT_CONTAIN’, ‘DOES_NOT_CONTAIN_CASE_SENSITIVE’, ‘STARTS_WITH’, ‘STARTS_WITH_CASE_SENSITIVE’,
    ‘ENDS_WITH’, ‘ENDS_WITH_CASE_SENSITIVE’, ‘EQUAL’, ‘EQUAL_CASE_SENSITIVE’, ‘NULL’, ‘NOT_NULL’];
    var numericcomparisonoperators = [‘EQUAL’, ‘NOT_EQUAL’, ‘LESS_THAN’, ‘LESS_THAN_OR_EQUAL’, ‘GREATER_THAN’, ‘GREATER_THAN_OR_EQUAL’, ‘NULL’, ‘NOT_NULL’];
    var datecomparisonoperators = [‘EQUAL’, ‘NOT_EQUAL’, ‘LESS_THAN’, ‘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;
    }
    }
    });

    Any help would be much appreaciated.

    Thank you,

    Michael


    Peter Stoev
    Keymaster

    Hi mickarrastia,

    Thanks for writing.

    1. Here’s a sample with custom filter conditions: http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/filterconditions.htm?classic
    2. Multiple Sorting in jqxGrid is not supported.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

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

You must be logged in to reply to this topic.