When using the MVC helpers and want to update a filter on the client (without using the built-in column filters), the filter (and whole request) that gets sent to the server is different than the filter format that the MVC extensions produce so it is impossible to modify client filters when using the MVC extensions.
For example if I had a grid declaration like this:
The above filter would look something like this:
ID~eq~1~and~(StartDate~gte~datetme'2012-10-01'~and~StartDate~lte~datetime'2012-10-02')
Then after the user selects a different date range, I try to update the filter using JavaScript like so:
This filter expression looks like the filterExpression variable when it gets sent to the server.
Is there a way to implement custom client side filtering compatible with MVC extensions (and not having to re-invent the wheel on all our own filtering and sorting that we already do) or is this another limitation of the MVC extensions?
What is the point of sending completely different filter and other expressions using the MVC extensions than the standalone Kendo UI Web package? Do you have any examples of how to manipulate the filter, sort, group and aggregate expressions defined using MVC helpers using custom client side JavaScript or is that another thing that's not currently possible with the MVC extension?
For example if I had a grid declaration like this:
@(Html.Kendo.Grid<Model>()
.DataSource(dataSource => dataSource
.Read(
"JsonAction"
,
"Controller"
)
.Filter(filter =>
{
filter.Add(f => f.ID)
.IsEqualTo(ViewBag.ID));
filter.Add(f => f.StartDate)
.IsGreaterThan(ViewBag.StartDate)
.And()
.IsLessThan(ViewBag.EndDate)
})
)
)
The above filter would look something like this:
ID~eq~1~and~(StartDate~gte~datetme'2012-10-01'~and~StartDate~lte~datetime'2012-10-02')
Then after the user selects a different date range, I try to update the filter using JavaScript like so:
var
filterExpression = {
logic:
'and'
,
field:
'PublisherID'
,
operator:
'eq'
,
value: @Session[
"PublisherID"
],
filters: [
{ field:
'StartDate'
, operator:
'gte'
, value: startDate, logic:
'and'
},
{ field:
'StartDate'
, operator:
'lte'
, value: endDate }
]
};
grid.dataSource.filter(filterExpression);
grid.dataSource.read();
This filter expression looks like the filterExpression variable when it gets sent to the server.
Is there a way to implement custom client side filtering compatible with MVC extensions (and not having to re-invent the wheel on all our own filtering and sorting that we already do) or is this another limitation of the MVC extensions?
What is the point of sending completely different filter and other expressions using the MVC extensions than the standalone Kendo UI Web package? Do you have any examples of how to manipulate the filter, sort, group and aggregate expressions defined using MVC helpers using custom client side JavaScript or is that another thing that's not currently possible with the MVC extension?