'make a filter in blazor im working with but when it works the renderizing number of page not works good
some one can help me with that I'm trying this:
private string searchTerm = "";
private string SearchTerm
{
get { return searchTerm; }
set { searchTerm = value; FilterRecords(); }
}
i am doing this but the records when seratfilter is not empty the pagination note refresh at all only show 36 of 40 pagezie when filtering is n the number of pagination is so many when filtering is too n not refreshing what i am missing or what it needs to refresh my list objerct; n my pagination footer, i dontk know, some one to help me,
protected override async Task OnInitializedAsync()
{ if (searchTerm == "" && string.IsNullOrEmpty(searchTerm))
{
//here iget my data to list
proof();
}
else { }
//display total page buttons
pagerSize = 3;
pageSize = 40;
curPage = 1;
articleModel = await ListAll((curPage - 1) * pageSize, pageSize, sortColumnName,
sortDir, searchTerm);
totalRecords = await Count(searchTerm);
totalPages = (int)Math.Ceiling(totalRecords / (decimal)pageSize);
SetPagerSize("forward");
}
public void FilterRecords()
{
endPage = 0;
this.OnInitializedAsync().Wait();
}
My Methosto retrive data
public Task<int> Count(string search)
{
var totArticle = outputFileList.Where(x => x.name.Contains(search)).Count();
return Task.FromResult(totArticle);
}
public Task<List<FileList>> ListAll(int skip, int take, string orderBy, string
direction = "DESC", string search = "")
{
var articles = outputFileList.Skip(skip).Take(take).Where(x =>
x.name.Contains(search)).ToList();
return Task.FromResult(articles);
}
but the first time the result is good all as i wanted but when i do the filter doesnt works check the results
and it show 40 per page but when filtering is shows 36 in one 29 ente next n so on it only filtering by pages n not rendering all the list n restart the pagination not works at all what can i do some suggestions
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|