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
510
Is there any way to make ig grid support full-text search?
posted

Is there any way to make ig grid support full-text search?

Parents
No Data
Reply
  • 23953
    Suggested Answer
    Offline posted

    Hi,

    Full-text search is not supported out of the box, but you can easily implement it yourself.

    Here is what you should do:

    1.Hide the filter, so there is no filtering UI available. Use igGridFiltering.toggleFilterRowByFeatureChooser method.

    2.Create your custom filter UI, for example simple input field and "Find" button.

    3.Use the public igGridFiltering.filter method to initiate filtering. You should define filtering expression for each field in your grid. Take into account the type of the columns in the grid.

    Here is an example implementation of a full-text filtering function:

     

    Code Snippet
    1. function fullTextFiltering(searchTerm) {
    2.     var $grid = $("#grid1");
    3.     var filterExpressions = [];
    4.     var cols = $grid.data("igGrid").options.columns;
    5.     for(var i = 0; i < cols.length; i++) {
    6.         if (cols[i].dataType === "string")
    7.             filterExpressions.push({fieldName: cols[i].key, expr: searchTerm, cond: "contains", logic: "OR"});
    8.     }
    9.     $grid.igGridFiltering("filter", filterExpressions, false);
    10. }

     

    Hope this helps,

    Martin Pavlov

    Infragistics, Inc.

Children