I have downloaded the newest release of ASP.Net MVC Q2(2011.2.712) release. And then i upgraded my current solution (2011.1.315).
But as far as i can see client side filtering does not work. (But it is working properly as expected in 2011.1.315 release). The strange thing is that when i filter the data by clicking the filter icon in grid, it filters successfully, but not using client method grid.filter().
Any ideas???
Asanka
My code snippet:
var grid = $('#GridCompletedTrips').data('tGrid');
var filterstring = "";
filterstring = "PassengerCount~eq~2";
grid.filter(filterstring);
18 Answers, 1 is accepted
Indeed, this is an issue with the current release. However, we have managed to address it and I have attached a build which contains the fix.
Greetings,Rosen
the Telerik team
Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!
can you also attach umninified version of the scripts, please?
Thanks.
There is another a problem with this build. When no results are returned footer/pager part of the grid freezes (with invalid item count and pages).
Is there a build fixing this?
Could you please provide a bit more information such a the view's declaration? Also please check if there are any javascript errors on the page.
Regards,Rosen
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
I too experienced this issue and when I applied the hotfix, the issue was resolved... Great! However, I am working on a large team in a CI environment. I *could* write some sort of custom script to handle the hotfix until the next full release is available but, I was wondering if it would be possible to have a Nuget package for the hotfix. This would greatly simplify our development environments and builds and make applying hotfixes much simpler going forward.
Thoughts?
Thanks in advance,
Jeff
Bart
I couldn't figure out why my grid.Filter() wasn't working and fortunately ran across your comment!
I would also like to know if there is any plan to change this behavior?
I'm also trying to make a personalized filter, something similar to the date range of Telerik Ajax Filter Template ( http://demos.telerik.com/aspnet-ajax/grid/examples/programming/filtertemplate/defaultcs.aspx )
here is my View:
Html.Telerik().Grid<Bilhete>()
.Name(
"bGrid"
)
.Columns(columns =>
{
columns.Bound(o => o.NumeroDestino);
columns.Bound(o => o.DataChamada);
columns.Bound(o => o.DuracaoOriginal);
columns.Bound(o => o.ValorOriginal);
columns.Bound(o => o.Localidade);
})
.DataBinding(u => u.Ajax().OperationMode(GridOperationMode.Client)
.Select(
"SelectBilhete"
,
"Tel"
,
new
{batchId = Model.BatchId, userCode = Model.UserCode, planoId = Model.PlanoId }))
.Sortable()
.Pageable(pager => pager.PageSize(10).Style(GridPagerStyles.NextPreviousAndInput))
And using Chrome's Inspect element, I have a console to run javascript: (so I can test it)
var
grid = $(
'#bGrid'
).data(
'tGrid'
);
grid.filter(
"NumeroDestino~eq~1019"
);
> TypeError: Object
#<Object> has no method 'filter'
Am I doing something wrong?
Indeed, setting filter when client operation mode is enabled is currently not supported. However, this can be workaround to a degree by manually parsing the filter expression and assigning it to the DataSource component of the grid. I have attached a modified version of this CodeLibrary which demonstrates a possible implementation.
Regards,Rosen
the Telerik team
How is the JavaScript code you posted called? For example, is it in an event handler?
Update: Try and add .Filterable() to your grid and see if you still get the JavaScript error.
Gregg, I just tried to add .Filterable() and it didn't return an error, but the filter didn't work that way.
Rosen, that worked GREAT, the grid.dataSource.filter really did the trick, but how can I do a between filter? (greater than and lower than)
like: grid.filter("field~ge~10255~field~le~29103");
I would like to do something like this:
dataSource.filter([
{ field: "Price", operator: "ge", value: 3.14 },
{ field: "Price", operator: "le", value: 42 }
]);
but this will not work
var
grid = $(
'#bGrid'
).data(
'tGrid'
);
var
A =
new
Array();
A.push({ field:
"Price"
, operator:
"ge"
, value: 3.14 });
A.push({ field:
"Price"
, operator:
"le"
, value: 42 });
grid.dataSource.filter(A);
Thanks a lot Gregg and Rosen :)
-----
Just for the record, I had to add grid.columns[columnumber].filters to the pagination be able to work as it is suppose to.
Here is an example of how it is done:
var
grid = $(
'#bGrid'
).data(
'tGrid'
);
var
A =
new
Array();
A.push({ field:
"Price"
, operator:
"ge"
, value: 3.14});
A.push({ field:
"Price"
, operator:
"le"
, value: 42 });
grid.dataSource.filter(A);
grid.columns[1].filters = (grid.columns[1].filters || []);
grid.columns[1].filters.push({ operator:
"ge"
, value: 3.14 });
grid.columns[1].filters.push({ operator:
"le"
, value: 42 });
I hope this can be useful to anybody who also needs it.
Is this issue still present in the 2012 Q1 release (version 2012.1.214.0)?
i tried ur sample project and it works great!!!
Although if the operator in filter is selected as 'endswith' and if u tyr to filter unexpected results are returned. For instance if the value for the 'endswith' operator is set as say a 'n' letter word, it returns the result as well as data which are (n-1) letter long if there are any. This behaviour is also found in the online demos (for client operation mode filtering). i made a change in ur js file to test this and i was able to reproduce the same issue. Please find the details in the attachment files. Could you please suggesta workaround for this issue.
Regards,
Sathish
Thanks for your solution, it worked for me as well! One thing, though, and apologies if this has been asked before (I can't seem to find it if it has), is it possible to actually update the filter icon and the values that come up when you click the filter icon for your column? I'm loading the filters from the database and at the moment I can filter it but there is no visual to show that there is currently an active filter, so the user won't know they're not seeing all the data. I want to avoid a custom solution if there's one built in!
Thanks!
$('[data-columnname="ContactName"] .t-grid-filter').addClass('t-active-filter')
Works like a charm!