I want to implement filtering for a column which should filter when a dropdown selection happens.
How could I populate the filter dropdown?
I am following your sample project for adding drop down in filter on few of column on my iggrid. In my case i am using remote filtering which causing problem. Below is the test case.
Below is code details.
function BindGrid(stateReferenceId, responsedata) {
var combodata = JSON.parse(responsedata)
$('#declarationGrid').igGrid({
width: "100%",
dataSource: "/Declaration/GetPagedData?stateReferenceId=" + stateReferenceId,
responseDataKey: "Data.data",
autoGenerateLayouts: false,
autoGenerateColumns: false,
columns: [
{ headerText: "No", key: "DeclarationNo", dataType: "number", template: "<a href='http://localhost:14152/Home/Sample/1' > ${DeclarationNo} </a>" },
{ headerText: "Article No", key: "ArticleNo", template: "<a href='http://localhost:14152/Home/Sample/1' > ${ArticleNo} </a>" },
{ headerText: "Article Name", key: "ArticleName", template: "<a href='http://localhost:14152/Home/Sample/1' > ${ArticleName} </a>" },
{ headerText: "Site Name", key: "SiteName", template: "<a href='http://localhost:14152/Home/Sample/1' > ${SiteName} </a>" },
],
features: [
{
filterExprUrlKey: 'filter',
filterLogicUrlKey: 'filterLogic',
caseSensitive: false,
name: 'Filtering',
type: "remote",
advancedModeEditorsVisible: true,
columnSettings: [
columnKey: "ArticleNo",
allowFiltering: false,
},
]
});
var articleNos = [];
var type = [];
var lang = [];
var vale = '';
$.each(combodata.Data.data, function (index, value) {
if (value.ArticleNo !== null)
if (articleNos.indexOf(value.ArticleNo) === -1)
articleNos.push(value.ArticleNo);
if (value.Type !== null)
if (type.indexOf(value.Type) === -1)
type.push(value.Type);
if (value.Language !== null)
if (lang.indexOf(value.Language) === -1)
lang.push(value.Language);
$($('tr[data-role="filterrow"] td')[1]).append("<div id='filterArticalNoCombo'></div>");
$("#filterArticalNoCombo").igCombo({
dataSource: articleNos,
multiSelection: "onWithCheckboxes",
top: "20px",
selectionChanged: function (evt, ui) {
var expressions = $("#declarationGrid").data("igGrid").dataSource.settings.filtering.expressions;
$("#declarationGrid").data("igGrid").dataSource.settings.filtering.expressions = [];
var newExpressions = [];
// first delete all expressions for this column
for (var i = 0; i < expressions.length; i++) {
if (expressions[i].fieldName !== "ArticleNo")
newExpressions.push(expressions[i]);
}
if (ui.items !== null) {
var itemsLength = ui.items.length;
for (var i = 0; i < itemsLength; i++) {
vale += ui.items[i].value + ',';
newExpressions.push({ fieldName: "ArticleNo", expr: vale, cond: "equals", logic: "AND" });
$("#declarationGrid").igGridFiltering("filter", newExpressions);
public dynamic GetPagedData(int stateReferenceId, int pageSize = 10, int pageIndex = 0, string sortField = "", bool isAscending = false, List<GridFilterCondition> gridFilter = null )
JavaScriptSerializer ser = new JavaScriptSerializer();
var datalist = _sampleDataProvider.GetData();
var pagedData = datalist.Skip(pageIndex * pageSize).Take(pageSize).ToList();
var jsonDataObj = Json(new
recordCountKey = datalist.Count(),
responseDataKey = "data",
data = pagedData
string jsonData = ser.Serialize(jsonDataObj);
return jsonData;
Hello Tsvetelina -
Is there any update on the status of implementing the OR filter via the Advanced Filter using OData in the igGrid?
I know that OData now supports this and I've tested it.
Seems like the igGrid is always putting in "AND" when it should be "OR"
Is there a possible work around for this that you know of?
It is an important requirement for my project.
Thank You!
Dominick
Hello Joern,
This is another known limitation from the previous releases.
http://help.infragistics.com/Help/Doc/jQuery/2013.2/CLR4.0/html/Known_Issues_and_Limitations_2013_Volume_2.html#_Ref370551345
It's in our backlog item list for the future release ( as the newer versions of Odata support this)
Thank you for using Ignite UI!
Hello,
I tried to implement this with an oData source, but it does not work.
The multiple selections are added to the filter with 'logic: "OR"' - it does not seem to work with oData. The filter expressions are translated to a $filter with "and" - therefore the grid does not display anything if there is more than one selection.
Can you change the sample so that it works with oData?
Thanks!
Joern
Hello Martin,I'm using your sample to use and I found a bug. Here's the steps:1. Select the City: MéxicoD.F.2. In CustomerID (contains filter): ANA
(At this moment all it's ok.)
3. Clear filter of CustomID
The filter "City" is no longer active, all rows are displayed.
What should I change to run all the filters at the same time?
Thanks in advance,Olivier