Reputation: 3143
I have site wide search where I put the search results into several Rad Grids. I hide the grid when there are no rows in the grid. I have a special case scenario that I don't want to hide the grid when the user applies column filters and there are no results. I want the user to be able to modify the column filters despite the fact that there are no results. My current code hides the grid and doesn't allow the user to modify the column filters.
Is there a way to know when filters are applied on the RadGrid from the client side?
My client code looks like:
function OnClientDataBound(sender, args) {
toggleLoadingPanel(sender.get_id(), false);
var grid = $find(sender.ClientID);
var masterTable = grid.get_masterTableView();
var rows = masterTable.get_dataItems();
// I want to be able to determine if the grid has filters applied here
// so that I don't hide it in this case.
if (rows == 0) {
var words = sender.ClientID.split("_");
var divName = "#div" + words[words.length-1];
jQuery(divName).hide();
}
}
Upvotes: 0
Views: 3894
Reputation: 8949
Server side (just in case you may find it useful):
If you have a Column
object then you can use the CurrentFilterFunction
and CurrentFilterValue
to get/set that column's filter.
If you want to inspect the entire grid in one go then you can use yourRadGridObject.MasterTableView.FilterExpression
Client side:
Upvotes: 2