lpa Posted May 8, 2019 Share Posted May 8, 2019 I tried to add the page id to be searchable in the admin Ajax search-field. The help message says the field has to be text-based: "Enter the names for one or more text-based fields that you want to search, separating each by a space." Is there any way to add the page id to be searchable? Link to comment Share on other sites More sharing options...
dragan Posted May 8, 2019 Share Posted May 8, 2019 Not sure you can change that. But you can use the default "Find" Lister for that? Link to comment Share on other sites More sharing options...
jom Posted May 20, 2020 Share Posted May 20, 2020 i'm at the same point as Ipa: need to add a number field to the admin live search. do I have to copy the module to the site/ folder and change it there? Link to comment Share on other sites More sharing options...
matjazp Posted May 20, 2020 Share Posted May 20, 2020 Perhaps this: https://processwire.com/talk/topic/23613-search-for-page-id/ ? Link to comment Share on other sites More sharing options...
jom Posted May 21, 2020 Share Posted May 21, 2020 beauty! Works perfectly well - thanks! I got stuck in the forum search, looking for admin live search and integer values. I cite here the code, just in case: On 5/7/2020 at 11:56 PM, Robin S said: $wire->addHookAfter('ProcessPageSearch::findReady', function(HookEvent $event) { $selector = $event->return; $q = $event->wire('input')->get('q'); // If the admin search query is a number if(is_numeric($q)) { // Get the individual pieces of the selector $selector_pieces = explode(', ', $selector); // Modify the first piece so that it includes an ID clause in an OR-group $selector_pieces[0] = "({$selector_pieces[0]}), (id=$q)"; // Replace the original selector $event->return = implode(', ', $selector_pieces); } }); Link to comment Share on other sites More sharing options...
matjazp Posted May 21, 2020 Share Posted May 21, 2020 If you ask me, searching by id should be made configurable in the module settings, but solution from Robin works, of course. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now