I am using mvc3 and my helper is as follows. I want to filter some of the visible columns ( not all ) and I want the advanced filter icon only to show.
I have tried many variations and always end up with the chooser icon which when clicked allows the columns to be hidden, the column chooser and the advanced filter options.
I can't find any MVC demos for this type of thing. I have looked the generated javascript and that also looks similar to your demo.
Infragistics.Web.Mvc.IGrid<DataTable> item1 = Html.Infragistics().Grid<DataTable>().DataSource(Model); Infragistics.Web.Mvc.IGrid<DataTable> item2 = item1.ID("GetSeriesDialogGrid"); Infragistics.Web.Mvc.IGrid<DataTable> item3 = item2.Features( features => { features.Hiding().ColumnSettings( settings => { settings.ColumnSetting().ColumnKey("SeriesCode").AllowHiding(false).Hidden(true); settings.ColumnSetting().ColumnKey("SystemLanguageCode").AllowHiding(false).Hidden(true); settings.ColumnSetting().ColumnKey("SeriesSpecification").AllowHiding(false).Hidden(true); settings.ColumnSetting().ColumnKey("MarketCode").AllowHiding(false).Hidden(true); settings.ColumnSetting().ColumnKey("StartDate").AllowHiding(false).Hidden(true); settings.ColumnSetting().ColumnKey("UnitMultiplier").AllowHiding(false).Hidden(true); settings.ColumnSetting().ColumnKey("CountryName").AllowHiding(false).Hidden(true); settings.ColumnSetting().ColumnKey("IsExportable").AllowHiding(false).Hidden(true); } ); features.Paging().PageSize(10); features.Filtering().Mode(FilterMode.Advanced); //.ColumnSettings( ////settings => //// { //// settings.ColumnSetting().ColumnKey("CurrencyName").AllowFiltering(true); //// } //); } );
Infragistics.Web.Mvc.IGrid<DataTable> item4 = item3.DataBind(); for (int i = 0; i < item4.Model.Columns.Count; i++) { switch (item4.Model.Columns[i].Key) { case "SeriesDescription": item4.Model.Columns[i].HeaderText = "Description"; break; case "SeriesName": item4.Model.Columns[i].HeaderText = "Series ID"; break; case "DataTypeName": item4.Model.Columns[i].HeaderText = "Series Type"; break; case "CurrencyName": item4.Model.Columns[i].HeaderText = "Currency"; break; case "UnitName": item4.Model.Columns[i].HeaderText = "Unit"; break; case "DataFreqName": item4.Model.Columns[i].HeaderText = "Frequency"; break; } } MvcHtmlString item6 = item4.Render(); @item6;
My ig.loader is as follows
$.ig.loader({ scriptPath: "../../Scripts/", cssPath: "../../Content", resources: "igTree,igGrid.Paging.Filtering" });
The generated javascript is as follows
$(function () {$('#GetSeriesDialogGrid').igGrid({ dataSource: {"Records":[{"SeriesCode":1,"SystemLanguageCode":0,"SeriesName":"AMFN","SeriesDescription":"AMF NZX NZ","SeriesSpecification":"Anhydrous milk fat (AMF)|global trading|New Zealand Exchange (NZX); New Zealand|||[futures]","DataTypeName":"Future","DataFreqName":"Daily","MarketCode":90,"StartDate":"\/Date(1299801600000)\/","UnitName":"Metric Tonne","CurrencyName":"US Dollar","CountryName":"None","IsExportable":false},{"SeriesCode":2,"SystemLanguageCode":0,"SeriesName":"ALSC","SeriesDescription":"Aluminium ingot SHFE Shanghai CN","SeriesSpecification":"Aluminium ingot|minimum 99.7% aluminium|Shanghai Futures Exchange|China||[futures]","DataTypeName":"Future","DataFreqName":"Daily","MarketCode":669,"StartDate":"\/Date(1041465600000)\/","UnitName":"Metric Tonne","CurrencyName":"Chinese Yuan","CountryName":"None","IsExportable":false},{"SeriesCode":3,"SystemLanguageCode":0,"SeriesName":"AJCM","SeriesDescription":"Apple conc 70Bx MGEX MN US","SeriesSpecification":"Apple concentrate|minimum 70 degrees Brix|exchange-approved warehouses; mainland USA|Minneapolis Grain Exchange (MGEX); USA||[futures]","DataTypeName":"Future","DataFreqName":"Daily","MarketCode":359,"StartDate":"\/Date(1344812400000)\/","UnitName":"US Gallon","CurrencyName":"US Dollar","CountryName":"None","IsExportable":false},{"SeriesCode":4,"SystemLanguageCode":0,"SeriesName":"AZUK","SeriesDescription":"Beans azuki red KCE Fukuoka JP","SeriesSpecification":"Redbean Azuki|grade no 2|produced in Hokkaido|Kansai Commodity Exchange ; Japan||[futures]","DataTypeName":"Future","DataFreqName":"Daily","MarketCode":383,"StartDate":"\/Date(998866800000)\/","UnitName":"Kilogram","CurrencyName":"Japanese Yen","CountryName":"None","IsExportable":false},{"SeriesCode":5,"SystemLanguageCode":0,"SeriesName":"AZUT","SeriesDescription":"Beans azuki red TGE Tokyo","SeriesSpecification":"Redbean Azuki|grade no 2 polished|produced in Hokkaido|Tokyo Grain Exchange; Japan||[futures]","DataTypeName":"Future","DataFreqName":"Daily","MarketCode":383,"StartDate":"\/Date(726105600000)\/","UnitName":"Kilogram","CurrencyName":"Japanese Yen","CountryName":"None","IsExportable":false},{"SeriesCode":6,"SystemLanguageCode":0,"SeriesName":"BARB","SeriesDescription":"Barley feed BSE Budapest HU","SeriesSpecification":"Barley|maximum 14.5% moisture|maximum 5% damaged kernel|maximum 10% rye and oats together|Budapest Stock Exchange; Hungary|[futures]","DataTypeName":"Future","DataFreqName":"Daily","MarketCode":446,"StartDate":"\/Date(963788400000)\/","UnitName":"Metric Tonne","CurrencyName":"Hungarian Forint","CountryName":"None","IsExportable":false},{"SeriesCode":7,"SystemLanguageCode":0,"SeriesName":"BARS","SeriesDescription":"Barley feed ASX Sydney AU","SeriesSpecification":"Feed Barley|Australian Securities Exchange (ASX)|Sydney; Australia|||[futures]","DataTypeName":"Future","DataFreqName":"Daily","MarketCode":446,"StartDate":"\/Date(1250550000000)\/","UnitName":"Metric Tonne","CurrencyName":"Australian Dollar","CountryName":"None","IsExportable":false},{"SeriesCode":8,"SystemLanguageCode":0,"SeriesName":"BARW","SeriesDescription":"Barley west no 1 ICE Winnipeg CA","SeriesSpecification":"Feed barley|free on board at the buyers facility|in Lethbridge Canada|Intercontinental Exchange (ICE) Canada||[futures]","DataTypeName":"Future","DataFreqName":"Daily","MarketCode":446,"StartDate":"\/Date(725846400000)\/","UnitName":"Metric Tonne","CurrencyName":"Canadian Dollar","CountryName":"None","IsExportable":false},{"SeriesCode":9,"SystemLanguageCode":0,"SeriesName":"BCRD","SeriesDescription":"Crude oil Brent ICE London","SeriesSpecification":"Crude petroleum oil|specification:current pipeline|export quality Brent blend|as supplied at Sullom Voe|Intercontinental Exchange (ICE); London|density: 0.8399 [futures]","DataTypeName":"Future","DataFreqName":"Daily","MarketCode":181,"StartDate":"\/Date(599702400000)\/","UnitName":"Barrel","CurrencyName":"US Dollar","CountryName":"None","IsExportable":false},{"SeriesCode":10,"SystemLanguageCode":0,"SeriesName":"BUTH","SeriesDescription":"Butter Eurex Frankfurt DE","SeriesSpecification":"Butter|Eurex|Frankfurt; Germany|||[futures]","DataTypeName":"Future","DataFreqName":"Daily","MarketCode":89,"StartDate":"\/Date(1275260400000)\/","UnitName":"Metric Tonne","CurrencyName":"European Euro","CountryName":"None","IsExportable":false}],"TotalRecordsCount":0,"Metadata":{"timezoneOffset":0,"timezoneOffsets":{"1":{"StartDate":0},"2":{"StartDate":0},"3":{"StartDate":3600000},"4":{"StartDate":3600000},"5":{"StartDate":0},"6":{"StartDate":3600000},"7":{"StartDate":3600000},"8":{"StartDate":0},"9":{"StartDate":0},"10":{"StartDate":3600000}}}},dataSourceType: 'json',autoGenerateColumns: false,autoGenerateLayouts: false,mergeUnboundColumns: false, responseDataKey: 'Records', generateCompactJSONResponse: false, enableUTCDates: true, columns: [ { headerText: 'SeriesCode', key: 'SeriesCode', dataType: 'number', width: null }, { headerText: 'SystemLanguageCode', key: 'SystemLanguageCode', dataType: 'number', width: null }, { headerText: 'Series ID', key: 'SeriesName', dataType: 'string', width: null }, { headerText: 'Description', key: 'SeriesDescription', dataType: 'string', width: null }, { headerText: 'SeriesSpecification', key: 'SeriesSpecification', dataType: 'string', width: null }, { headerText: 'Series Type', key: 'DataTypeName', dataType: 'string', width: null }, { headerText: 'Frequency', key: 'DataFreqName', dataType: 'string', width: null }, { headerText: 'MarketCode', key: 'MarketCode', dataType: 'number', width: null }, { headerText: 'StartDate', key: 'StartDate', dataType: 'date', width: null },{ headerText: 'Unit', key: 'UnitName', dataType: 'string', width: null }, { headerText: 'Currency', key: 'CurrencyName', dataType: 'string', width: null }, { headerText: 'CountryName', key: 'CountryName', dataType: 'string', width: null }, { headerText: 'IsExportable', key: 'IsExportable', dataType: 'bool', width: null } ], features: [ { columnSettings: [ { columnIndex: -1, columnKey: 'SeriesCode', allowHiding: false, hidden: true }, { columnIndex: -1, columnKey: 'SystemLanguageCode', allowHiding: false, hidden: true }, { columnIndex: -1, columnKey: 'SeriesSpecification', allowHiding: false, hidden: true }, { columnIndex: -1, columnKey: 'MarketCode', allowHiding: false, hidden: true }, { columnIndex: -1, columnKey: 'StartDate', allowHiding: false, hidden: true }, { columnIndex: -1, columnKey: 'UnitMultiplier', allowHiding: false, hidden: true }, { columnIndex: -1, columnKey: 'CountryName', allowHiding: false, hidden: true }, { columnIndex: -1, columnKey: 'IsExportable', allowHiding: false, hidden: true } ], name: 'Hiding' }, { recordCountKey: 'TotalRecordsCount', pageIndexUrlKey: 'page', pageSizeUrlKey: 'pageSize', name: 'Paging', pageSize: 10 }, { filterExprUrlKey: 'filter', filterLogicUrlKey: 'filterLogic', name: 'Filtering', mode: 'advanced', type: 'local' } ], isDataSetTableSource: true, primaryKey: 'SeriesCode', localSchemaTransform: true });});
Jim
Hi Jim,Thank you for posting in our forums! I can see that you are using our loader. You can add the code below in the the “ready” callback like this:
$.ig.loader({ scriptPath: "../../Scripts/", cssPath: "../../Content", resources: "igTree,igGrid.Paging.Filtering", ready: function () { $.ui.igGridFiltering.prototype.renderInFeatureChooser = false; } });
Also add this before the definition of the grid: @Html.Infragistics().Loader().Render()
This code will override the Filtering's option for rendering a Feature chooser. And then both Filtering and Hiding icons will be rendered in the header.
I hope this helps!
Kind regards,Petko ZhekovSoftware Engineer
Stupid me - I needed to explicitly disable hiding on the appropriate columns. All sorted