|
Rank: Advanced Member
Groups: Registered
Joined: 9/1/2010 Posts: 136
|
After a page of results is displayed on my web page, I want to re-sort the results in a different order when a button on the page is clicked. I know how to implement a comparer for the new sort order. I just don't know how to get the results to be sorted again and then displayed on page postback.
Thanks!
Dan
|
|
Rank: Advanced Member
Groups: Administrators, Registered
Joined: 10/20/2004 Posts: 456
|
Hi Dan, Thanks for your post. Please take a look at this page from the Help documentation; https://keyoti.com/produ.../CustomDataFilters.html
That should cover everything but of course please let us know if not. Dan Dan Wright
|
|
Rank: Advanced Member
Groups: Registered
Joined: 9/1/2010 Posts: 136
|
My custom data consists of a set of field names and values concatenated with separator characters. I have an author name compare class, implementing IComparer(Of Keyoti.SearchEngine.Search.ResultItem), and in its Compare function I retrieve one of these fields from the custom data and use the values to do the compare. This is all in the VB.NET code-behind for my search results page.
After the results are displayed, I want to be able to click a button and have Keyoti use the author name comparer to re-sort the results. It has to be done on postback in the code-behind, not in JavaScript. Also, I don't know anything about JSON, so I can't rely on that for the solution.
Is it possible to do what I described? The page you referenced is a different approach that I don't think is applicable to my situation. If I'm missing something, please let me know.
Thanks!
Dan
|
|
Rank: Advanced Member
Groups: Administrators, Registered
Joined: 10/20/2004 Posts: 456
|
Hi Dan, Sorry, I sent the wrong link before. This is about sorting when using JS; https://keyoti.com/produ.../CustomDataSorting.html
and this page is for when using our Control based usage (scroll down the page); https://keyoti.com/produ...ith%20Custom%20Data.htm
Sorry about that. Let us know if you have any trouble. Dan Dan Wright
|
|
Rank: Advanced Member
Groups: Registered
Joined: 9/1/2010 Posts: 136
|
I've studied that page and I think I understand what it's doing. But I don't understand how to trigger the ResultItemsFinalized action again to supply a different comparer. Is it like a whole new search, even though all that's changing is the sort order?
|
|
Rank: Advanced Member
Groups: Administrators, Registered
Joined: 8/13/2004 Posts: 2,669 Location: Canada
|
The re-sort is triggered by InvalidateChildControlHierarchy in the button handlers Protected Sub sortDownBT_Click(ByVal sender As Object, ByVal e As System.EventArgs) sortByDate = True sortDirection = sortDirection.Descending Sr1.InvalidateChildControlHierarchy() End Sub Protected Sub sortUpBT_Click(ByVal sender As Object, ByVal e As EventArgs) sortByDate = True sortDirection = sortDirection.Ascending Sr1.InvalidateChildControlHierarchy() End Sub and that causes ResultItemsFinalized to trigger again. It has to do the search again because it doesn't store all of the results anywhere between postbacks. Jim -your feedback is helpful to other users, thank you!
|
|
Rank: Advanced Member
Groups: Registered
Joined: 9/1/2010 Posts: 136
|
Thanks, Jim! That seems to be what I needed. I have some other, unrelated flow issues in my code to work out, but I'm quite sure that your suggestion about InvalidateChildControlHierarchy (which I had never seen or used before) solved my re-sorting issue.
Dan
|
|