I have an administrator named "Categories" and you have permission to type some letters and bring back a filtered list.
Although quite a standard stuff, I'm adding the result set with paging and running in an obstacle.
When you first come to the page, I have all the categories listed. When you type in the text box, you get a filtered list, but I only return the list and display it again. I do I do not show the whole page again.
Now when I press the Page 2 link, the filters are lost and I come back to my complete list again.
I know that in the code given below I am not holding the filter text in the functioning of my class and this is my problem which I think. Just need TTP how to get it.
How do I create a list? Relevant code below;
Controller
Public Task Category Categories (interdisciplinary page) {Categorized repository categoriesRepository = new categories budget (); CategoriesFormViewModelFVM = New CategoriesFormViewModel (); Fvm.categories = Categories repository. All (). Serial order (x = & gt; x.name). Tipped list (page.husvalue? Page value - 1: 0, cachehalper.get () category pages); See Return (FVM); } Public Functional jQuery Filterer Categories (String Filters) {Categorized Repository Categories Respository = New Categories Data Repository (); Back partial view ("Category List", Categories Resository, All () where (x => x.name.ToLower (). This includes (filter.toolver ()). Serial (x = & gt; X.name). ToPagedList (0, cache hanger.gate (.payment pages)); } View
& lt; Script type = "text / javascript" & gt; $ ('. FindCategory') Key (function () {var searchText = $ ('. FindCategory'). Val (); $ .post ('/ home / jQueryFilterCategories', {filter: searchText}, function (newHTML) {$ ('categories') .html (new HTML); return;});}); & Lt; / Script & gt; & Lt; Div class = "pager" & gt; & Lt;% = Html.Pager (helpers.cashhelper.get () .pages, models, categories.page number, model.rections, total requirements, "categories", "home")% & gt; & Lt; / Div & gt; & Lt; Div class = "categoryList" & gt; & Lt; Div & gt; & Lt; P & gt; Type here & lt;% = Html.TextBox ("searchTerm", Model.searchTerm, new {@ class = "FindCategory"}) & gt; & Lt; / P & gt; & Lt; / Div & gt; & Lt; Div class = "categories" & gt; & Lt;% HTML. RenderPartial ("Category List", Model. Comments); & Gt%; & Lt; / Div & gt; & Lt; / Div & gt;
public activity categories (int? Page, string? Filtered) {catalyzed Repository categories Resository = New categories repository (); CategoriesFormViewModelFVM = New CategoriesFormViewModel (); If (filter == faucet) fvm.categories = Categories Replayer all (). Order (x = & gt; x.name). Oppageist (page. HasValue? Page Value-1: 0, cachehalper.gate (.payment pages); Else fvm.categories = categoriesRepository.All () Where (x = & gt; x.name.ToLower (). Includes (filter.ToLower ()) .orderbie (x = & gt; x.name) ToPagedList (page. HasValue page Value - 1: 0, Also, you should modify your actionlinks according to your partial code in ClassList.
Comments
Post a Comment