Is there any way to make ig grid support full-text search?
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:
Hope this helps,
Martin Pavlov
Infragistics, Inc.
I was having a similar question and I noticed your example. I have it working great except I cannot for the life of me be able to hide the filtering UI.
Here is my code, what am i doing wrong?
$("#grid1").igGridFiltering("toggleFilterRowByFeatureChooser", null); $('#btnSearch').click(function () { var searchTerm = $("#searchTerm").val(); var $grid = $("#grid1"); var filterExpressions = []; var cols = $grid.data("igGrid").options.columns; for(var i = 0; i < cols.length; i++) { if (cols[i].dataType === "string") filterExpressions.push({fieldName: cols[i].key, expr: searchTerm, cond: "contains", logic: "OR"}); } $grid.igGridFiltering("filter", filterExpressions, false); });
@(Html.Infragistics().Grid<UsersViewModel>() .ID("grid1") .AutoGenerateColumns(false) .Columns(col => { col.For(x => x.FullName).DataType("string").HeaderText("Name").Width("200"); col.For(x => x.UltiProManagerName).DataType("string").HeaderText("Ultimate Manager").Width("150"); col.For(x => x.ManagerName).DataType("string").HeaderText("Approving Manager").Width("150"); col.For(x => x.Email).DataType("string").HeaderText("Email").Width("150"); col.For(x => x.LastLoginDateString).DataType("string").HeaderText("Last Login").Width("150"); }) .Features(features => { features.Paging().PageSize(50).Type(OpType.Local); features.Selection().Mode(SelectionMode.Row); features.Filtering().RenderFilterButton(false).RenderFC(false).FilterSummaryAlwaysVisible(false).; }) .RowTemplate("<tr><td>${FullName}</td><td>${UltiProManagerName}</td><td>${ManagerName}</td><td>${Email}</td><td>${LastLoginDateString}</td></tr>") .DataSourceUrl(Url.Action("BindGrid")) .PrimaryKey("ID") .DataBind() .Render() )
Hello Doug,
I suspect that the toggleFilterRowByFeatureChooser method is executed before the grid is actually initialized, thus there is no effect.
If you're using Infragistics loader in your view you should use the following code and put it after the grid chaining configuration.
$.ig.loader(function() {
$("#grid1").igGridFiltering("toggleFilterRowByFeatureChooser", null);
});
If you're not using Infragistics loader then use the following code(again after the grid chaining code):
$(function() {