jQWidgets Forums

jQuery UI Widgets Forums Grid how to iterate through filtersinfo

This topic contains 3 replies, has 2 voices, and was last updated by  Dimitar 11 years, 6 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • how to iterate through filtersinfo #31653

    DavidSimmons
    Participant

    I am trying to find a way or documentation to help me iterate through the filterinfo object to better understand it. Has anyone done this and could you help me with a small example.

    var filtersinfo = $(‘#jqxGrid’).jqxGrid(‘getfilterinformation’);

    filter – a filter object which may contain one or more filters.
    Properties and Methods of the filter object.
    getfilters – returns an array of all filters in the filter object. Each filter in the Array has:
    value – filter’s value.
    condition – filter’s operator. For String filter the value could be: ‘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. For Date and Number filter the value could be: ‘EQUAL’, ‘NOT_EQUAL’, ‘LESS_THAN’, ‘LESS_THAN_OR_EQUAL’, ‘GREATER_THAN’, ‘GREATER_THAN_OR_EQUAL’, ‘NULL’, ‘NOT_NULL’. For Boolean filter, the value could be: ‘EQUAL’, ‘NOT_EQUAL’
    type – filter’s type – ‘stringfilter’, ‘numericfilter’, ‘booleanfilter’ or ‘datefilter’.
    operator – ‘and’ or ‘or’. Determines the connection between the filters in the group.
    filtercolumn – the column’s datafield.
    filtercolumntext – the column’s text.

    how to iterate through filtersinfo #31681

    Dimitar
    Participant

    Hello DavidSimmons,

    There are some more things that you should know:

    1) filtersinfo is an array of all the applied filters. To access the filter, filtercolumn and filtercolumntext, you should have:

    var filtersinfo = $('#jqxGrid').jqxGrid('getfilterinformation');
    var firstFilter = filtersinfo[0].filter;

    This code gets the first applied filter.

    2) You can then call:

    var firstFilterInfo = firstFilter.getfilters();

    firstFilterInfo is also an array of the applied conditions in the filter.

    The fields of the firstFilterInfo array items are value (e.g. “Beate”), condition (e.g. “CONTAINS”), operator (e.g. 1) and type (e.g. “stringfilter”).

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

    how to iterate through filtersinfo #31791

    DavidSimmons
    Participant

    So if I wanted to pass the grid’s current filter object to a url, just like server side filtering would be this object?

    example

    var filtersinfo = $(jqxgrid).jqxGrid(‘getfilterinformation’);

    var Button = $(“

    “);
    Button.find(‘span’).addClass(‘ui-icon ui-icon-print’);
    Button.width(16);
    Button.jqxTooltip({ content: ‘Print!’, position: ‘mouse’, name: ‘Tooltip’, theme: theme });
    Button.appendTo(tableLeft);

    Button.click(function (event) {
    var filtersinfo = $(jqxgrid).jqxGrid(‘getfilterinformation’);
    $.ajax({
    type: “POST”,
    url: “Print.php”,
    data: filtersinfo
    }).done(function (msg) {
    $(jqxgrid).jqxGrid(‘updatebounddata’);
    });
    });

    how to iterate through filtersinfo #31872

    Dimitar
    Participant

    Hi DavidSimmons,

    Your approach is incorrect. The data field expects an object with key-value pairs, which filtersinfo is not. The easiest solution would be to bind the grid through the jqxDataAdapter plug-in. This way, the grid will automatically send variables to the server.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

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

You must be logged in to reply to this topic.