Buy Now
Sign in

Keep search term in the search widget field when moving from page to page with paginator

simelas , August 22 2018, 16:49
S
simelas 184
August 22 2018, 16:49 #379792
 1
 Answer
Hello everyone, hello Max
Question came few times : is there a simple way to keep the search term in the search field of the search widget, while moving from page to page with the paginator.
(This show an example of the solution i applied for Chronoconnectivity6 with the search widget but can be applied to any selector /filter.
Explanation: Currently (01 September2018) when filtering a database with the "Search Widget" , having set Model.field:{data:keywords}/- in the WHERE conditions of the database read function, the behaviour is as expected. e.g. the filter works properly.
However when moving from one page to the other using the paginator, the value in the search field is erased at the first move.
Debug show that on initial run: e.g. on using the search button, the keywords field if correctly filled. ( As example here i used [keywords] =>fire ; having on purpose worked with "Build a Basic lisitng" ).
Array
(
[option] => com_chronoconnectivity6
[cont] => manager
[conn] => article
[event] => index
[text5] =>
[keywords] => fire
Then when clicking on one of the paginator page , the filter is reset to blank,more precisely the additonnal parameter ( in the present case [keywords] => fire ) is not included in the paginator url of the paginator
Array
(
[option] => com_chronoconnectivity6
[cont] => manager
[conn] => article
[event] => index
[startat] => 0
(If after having filtered, one add manually a parameter to the paginator ( &keywords=fire) then the paginator works as expected : e.g. one can navigate through the paginated views with the paginatorkeeping the filtered data. Conclusion: the search parameter is not properly passed to the paginator (or this is not the right method)).
Solution applied:
In the relevant Form of the Views tab add an event that you can call 'select' for exemple.
In the Functions tab add a redirect action named for example "redirect_select' and for that redirect action add: in "Event" add index ; in "Redirect URL" add {url_self} ; in "URL Parameters" add the parameters of the desired filter field(s) , for example keywords={data:keywords} state={data:state} country_id_select={data:country_id_select} .
In Events tab add a new event named 'select'. In this event add {fn:redirect_select} and {redirect:index}
Save your connection and test. Now the paginator should behave as expected when using filters.
Several post in the forum ask for a solution and some solutions seems to have been proposed but nothing definitively crystal clear. Maybe there is a simpler way than the one proposed but at least it works well.
Maybe Max could you work a little bit on that matter.
Best Regards,
simelas
M
murilolule 17
August 01 2019, 14:47 #388577
Hello simelas!
I am using chronoconectivity version 6.1.
I have the same problem: I have a "Search" field and use what is typed there to search my table.
This works well, but when I use the paginator and change the page, the results appear as if they have no filter.

The above solution did not work for me. Can you see any other way?
S
simelas 184
August 23 2019, 23:20 #388967
Hello murilolule,
The proposed solution works well with all versions of CC6. Could you please be more specific or pm a screen shot of your setting or pm an admin code such as i can have a look /check on your site.
simelas@simelas.com
M
murilolule 17
August 26 2019, 12:29 #388987
In the end I can develop my search form.
I was not understanding the function of the "Search parameter name" field. It was blank.
I created a "Read Data" with "select type" -> "all matching records" with the "sortable fields" as "readdatamodel.name", "readdata. Lecture".
"Search parameter name" is set to "keywords"
and "Searchable fields" as "name".
After correctly setting the fields, the "search" widget worked.

Thanks for your attention and sorry for missing my return.
The result is here: https://www.educatu.com.br/transparencia/inscri%C3%A7%C3%B5es/lista-replanejamento-2019.html?conn=contando-registros