This question is locked. New answers and comments are not allowed.
Hello,
I've come to understand that filtering in the MVC grid only filters on current data. I need to return results to the (empty) grid based upon search filters that are entered. These are handled by JQuery and then a grid.ajaxRequest call is made, like so
this is my Select statement. I am using Ajax binding.
.Select("GetAllQuestion", "Question", new { id = -1 })
A -1 is passed for ID to indicate that nothing has been specified and nothing is returned to the view. Currently, the Grid supports functionality that takes a single ID and then selects that question and returns that question to the view. There is also a Detail view being implemented that also must be flexible for searching.
So now the functionality of this Grid must be expanded such that multiple filters can be specified and several (Potentially thousands) of results are returned. I created a Search Query class and I'm able to build my LINQ where clause and this is where it gets tricky. I have two issues I currently cannot find a solution for.
1. Paging. I could use EnableCustomBinding, but it apparently only accepts GridCommands as a parameter and I need a lot more than that. Paging is required such that I do not query the DB for all of its data at once. If I am returning 7,000 results, I only want to query for the first 10. This also makes getting the Total count an issue, since it is not known how many results I will be getting but I certainly do not want to request all the results at once.
The other issue will be much easier to resolve once I can find a solution for this issue. I already have an idea for my other issue that involves ViewData["filterParams"] to maintain the Filter parameters but then again I'm not really comfortable with ViewData nor how it works. So if you can help me understand how to use this as well, it would be appreciated. The filterParameters also must be applied on the DetailView when expanded.
Thanks for the help and let me know if you need any additional information.
I've come to understand that filtering in the MVC grid only filters on current data. I need to return results to the (empty) grid based upon search filters that are entered. These are handled by JQuery and then a grid.ajaxRequest call is made, like so
function ApplyQuestionFilters(sender) { var _grid = $("#QuestionGrid").data("tGrid"); var search = new Object(); search.IsQuestion = true; search.QuestionID = $("#QuestionIDSearch").val(); search.QuestionTitle = $("#QuestionTitleSearch").val(); search.OriginalURL = $('#OriginalURLSearch').val(); search.OriginalTitle = $('#OriginalTitleSearch').val(); search.ChronicID = $('#ChronicIDSearch').val(); search.TopicID = $('#TopicIDSearch').val(); search.ChannelID = $('#ChannelIDSearch').val() _grid.ajaxRequest({ id: -2, filterParams: JSON.stringify(search) });}this is my Select statement. I am using Ajax binding.
.Select("GetAllQuestion", "Question", new { id = -1 })
A -1 is passed for ID to indicate that nothing has been specified and nothing is returned to the view. Currently, the Grid supports functionality that takes a single ID and then selects that question and returns that question to the view. There is also a Detail view being implemented that also must be flexible for searching.
So now the functionality of this Grid must be expanded such that multiple filters can be specified and several (Potentially thousands) of results are returned. I created a Search Query class and I'm able to build my LINQ where clause and this is where it gets tricky. I have two issues I currently cannot find a solution for.
1. Paging. I could use EnableCustomBinding, but it apparently only accepts GridCommands as a parameter and I need a lot more than that. Paging is required such that I do not query the DB for all of its data at once. If I am returning 7,000 results, I only want to query for the first 10. This also makes getting the Total count an issue, since it is not known how many results I will be getting but I certainly do not want to request all the results at once.
The other issue will be much easier to resolve once I can find a solution for this issue. I already have an idea for my other issue that involves ViewData["filterParams"] to maintain the Filter parameters but then again I'm not really comfortable with ViewData nor how it works. So if you can help me understand how to use this as well, it would be appreciated. The filterParameters also must be applied on the DetailView when expanded.
Thanks for the help and let me know if you need any additional information.