Hello all,
Could someone point me to an example or suggest the best approach for this? The application is asp.net core 5 using Razor.
I am using GridColumnSettings in my grid because there is one SQL table to populate many different pages & we change elements based on the context of use.
On one page, we've added a custom function to the filtering for one column so that we can provide a SQL "IN" condition. This is working great. However for that one column, can someone suggest how to provide a custom filter menu so that we restrict what options are provided. (Users are going to be confused if they have options on the filter menu that do not work as they expected...)
I've tried a few examples found from searching this site but none seem to work. Either I got it wrong (for possible) or because of the columns.LoadSettings<Model.columns> from the server side, it doesn't execute any client side code on the .cshtml page.
I've included the relevant code below.
Any suggestions or examples will be greatly appreciated. Thank you.
This is the grid on the .cshtml page.
<div id="griddiv">
@(Html.Kendo().Grid<HPK_DATA>(Model.testdata)
.Name("grid")
.Columns(columns => {
columns.LoadSettings(Model.columns);
})
.Events(ev=>{
ev.Filter("onFilter");
//ev.FilterMenuInit("filterMenuInit");
})
.Pageable()
.Sortable()
.Scrollable()
.Filterable()
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.Read(read => read.Url(Url.Action()+"?handler=Read").Data("forgeryToken"))
)
)
</div>
This is a portion of the gridcolumnsetting code for brevity. The column that needs a custom filter menu is the SERIAL_NO.
IList<GridColumnSettings> columns = new List<GridColumnSettings>{
new GridColumnSettings
{
Member = "ROWID",
Title = "Id",
Visible = false,
Width = "15px",
Filterable = true
},
new GridColumnSettings
{
Member = "ITEM_NO",
Title = "Item No.",
Visible = true,
Width = "150px",
Filterable = true
},
new GridColumnSettings
{
Member = "SERIAL_NO",
Title = "Serial No.",
Visible = true,
Width = "150px",
Filterable = true
},