-
-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can we implement a search using async data from a server? #36
Comments
@fayazara Maybe a bit late, but this exactly what I've done for my product. Needs a bit of work, but not too complicated. Anything below "Content Types" is static. Then below that you have all the search results. |
@eelcoj how did you do it? did you use ninja-keys? |
@elalemanyo Yes, all it really does is fire a request to backend's search. The json response is then changed to match the data structure ninja keys need. |
@eelcoj can you show me how you are doing it? if it is possible. Thanks |
@elalemanyo Would only be useful if you use the same framework, right? In essence listen for the change event on the input field, when certain character threshold is met (eg. min. 3 characters), send async post request to get the search results, than merge this result into the data structure needed for ninja-keys. |
Yes, but it's not exactly designed for that. There are better tools for the job. Here's how you'd do it with NinjaKeys: ninja.addEventListener('change', (event) => {
debouncedSearch(event.detail.search); // define your debounced search function
}) One problem with this is that Ninja filters the One library that displays exactly a search modal is search-modal. Needs some love but does the job more cleanly. You just need to supply the search URL. |
Could you get around that by adding the search query as |
We're planning on making the ninja-keys as the primary search window for our tool. It works well for items which are defined already, but is there a way to make api requests and get data and show them in Ninja keys command palette?
CC: @ssleptsov
The text was updated successfully, but these errors were encountered: