Comments (5)
It's fine enough. No, it's not the best solution, but the rest of this package provides so much that I'm ok with it. I don't have time to submit any PRs, but maybe this would be a good one to open up? I guess starting with opening a new issue to discuss adding this as a first-class feature would be good if you wanted to do that, @elalemanyo. Then if @ssleptsov is open to the idea, we can hash out what that interface might look like.
from ninja-keys.
ok, I think this was more a "me" issue. I ended up getting it to work by rethinking how I was setting things up. Sorry for the noise 😄
from ninja-keys.
@jwoertink I'm looking for a way to add elements dynamically, the idea is to do a request to a search api using change
event. But what is the way to then add the new results without modifying the original ones forever?
Thanks
from ninja-keys.
@elalemanyo I'm using Vue2, but this is how I did it.
data() {
return {
searchResults: []
}
},
computed: {
hotkeys() {
const pages = [];
pages.push({
// push in the default stuff here
});
return pages;
}
},
mounted() {
this.setHotKeys();
},
methods: {
setHotKeys() {
this.$refs.ninjaKeys.data = [...this.searchResults, ...this.hotkeys];
},
searchResultChanged(event) {
const query = event.detail.search;
// perform search from query
this.setHotKeys(); // the magic line
}
}
It's not a super elegant solution, and I'm noticing a few weird things like if I'm searching on the back-end across multiple data fields, I might get results I want that don't have the title
of what was entered in which case no results are displayed. I did see there's a keywords
string option, but I didn't get that to work.
What I mean is, for example, if a Post has a title
and a content
field, and your search queries both, the title
might be "Let's make Cheese", and you searched "cheddar". In this case, ninja-keys doesn't return any results because the title
doesn't contain the word cheddar
. I think that's something you'd have to handle manually.
from ninja-keys.
Thanks @jwoertink for your explanation. Maybe this tool is not intended for adding search results, the solution does not seem very robust. Or what has been your experience?
from ninja-keys.
Related Issues (20)
- Items listed after an item with children aren't displayed HOT 6
- Potential memory leak
- Error: Using this with Nuxt 3 fails HOT 4
- Close button
- Sometimes there's no value loaded when an animationFrame is requested
- Hotkeys are triggered within the ninja-keys search input
- Can we implement a search using async data from a server? HOT 7
- .open() does not work with vue 2's this.$refs
- How to custom action-list scroll bar style
- requestAnimation runs even when ninja-keys isn't loaded
- Svelte example broken HOT 2
- Can't get command palette to open when <input>, <select>, or <textarea> have focus HOT 1
- any other CDNs available? Seeing a bunch of odd errors with the module version right now HOT 1
- How can the title be wrapped?
- Can't use navigation keys (arrow keys, enter etc.) HOT 2
- Is there any way to listen modal open or close? HOT 2
- Module error for [email protected]/lit-html.js HOT 6
- how to change group-header css ?
- ninja-header firstUpdated() Focus Error!
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ninja-keys.