Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1000
Filter row: Enter key and combobox
posted

Hello,

I implemented enter key support based on this forum post:

http://www.infragistics.com/community/forums/t/72196.aspx

It works for a single column but not for multiple columns.

So I changed the code based on the combobox filter sample from:

http://www.infragistics.com/community/forums/p/77913/394333.aspx#394333

    $(".ui-iggrid-filterrow.ui-widget").delegate("span.ui-igedit.ui-state-default.ui-widget.ui-corner-all.ui-igedit-container", "igeditorkeydown", function (evt, ui) {
        if (ui.key === 13) {

            var $grid = $(gridSelector);
            var $gridFiltering = $grid.data("igGridFiltering");
            var filtering = $grid.data("igGrid").dataSource.settings.filtering;
            var expressions = filtering.expressions;
            filtering.expressions = [];
            var newExpressions = [];
            // First delete all expressions for this column
            var colKey = $(this).data("colKey");
            for (var i = 0; i < expressions.length; i++) {
                if (expressions[i].fieldName !== colKey)
                    newExpressions.push(expressions[i]);
            }
            // Set a new filter expression
            var searchValue = $(this).data("igEditor").value();
            if (searchValue) {
                var colIndex = $(this).data("colIndex");
                var condition = $gridFiltering.options.columnSettings[colIndex].condition;
                newExpressions.push({ fieldName: colKey, expr: searchValue, cond: condition });
            }
            $grid.igGridFiltering("filter", newExpressions);
            //$gridFiltering.filter([], true);

            // Finally cancel the built-in filtering by using the private _timeoutId handle
            clearTimeout($gridFiltering._timeoutId);
        }
    });

Now I can set filters on multiple columns but I have to press the Enter key in each which is neither intuitive nor practical.

I have the following requirement:

- I need to use editor fields and comboboxes in the filter row

- The user should be able to enter a filter value and then use the Tab key or the mouse to switch to another filter cell

- When done, the user presses the Enter key and the grid displays the records based on all filters

(Filtering is remote using oData. Filtering can take some time and therefore auto-filtering after a delay does not work and makes a bad user experience.)

I cannot see how I can extend and combine Infragistic's samples to achive this? (Filter on multiple columns, use lookup comboboxes in filter row and only press the Enter key once to start filtering.)

Please help...

Thanks!

Best regards,

Joern