Ticket #837 (closed Enhancement: worksforme)
dm4-webclient: let plugins pre-select search mode
Reported by: | Malte | Owned by: | jri |
---|---|---|---|
Priority: | Major | Milestone: | Release 4.7 |
Component: | DeepaMehta Standard Distribution | Version: | 4.6.1 |
Keywords: | Cc: | ||
Complexity: | 3 | Area: | |
Module: | deepamehta-webclient |
Description
User data and user feedback per mail from the WTUI case (wikidata-topicmaps.wmflabs.org) suggests that people don't know that they need to change to the "Wikidata Search"-Search mode (in favor of the "By Text" search mode) to be able to query items from wikdata.org at all.
We could solve this issue (in this instance) if a developer would be able to select a custom search as the one selected by default or selected on the client side initialization of the wikidata plugin. Could you realize this or do you have other ideas how we could reduce the steps necessary for users to start using the WTUI as they expect?
I already tried to manually select the search through the usage of jquery but i never got it functional.
Thanks for your help!
Change History
comment:2 follow-up: ↓ 4 Changed 9 years ago by jri
At client-side your plugin can use the "init_2" event to select a search mode:
dm4c.add_listener("init_2", function() { dm4c.toolbar.searchmode_menu.select("your-search-mode") dm4c.toolbar.select_searchmode("your-search-mode") })
The 1st call let the search mode menu reflect your selection.
The 2nd displays your search mode's specific widget.
"your-search-mode" is the "ID" of your search mode as you've specified as the item value when adding your search mode to the search mode menu.
The init_2 event is fired just after init (there is init_3 too) and ensures your search mode selection overrides the default one as done by the webclient's fulltext plugin which uses the init event to select the "by-text" search mode.
This works since DM 4.1.3
Note: this solution (2 calls on dm4c.toolbar) is quite "hacky". The Webclient should provide a high-level call. The Webclient's entire search mode extension mechanism needs to be revised in a later DM version.
comment:3 Changed 9 years ago by jri
- Status changed from accepted to closed
- Resolution set to worksforme
comment:4 in reply to: ↑ 2 Changed 9 years ago by jri
Replying to jri:
Note: this solution (2 calls on dm4c.toolbar) is quite "hacky". The Webclient should provide a high-level call. The Webclient's entire search mode extension mechanism needs to be revised in a later DM version.
Meanwhile there is a higher-level API to select a searchmode programmatically. See #839.