GithubHelp home page GithubHelp logo

Comments (5)

jwoertink avatar jwoertink commented on September 1, 2024 2

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.

jwoertink avatar jwoertink commented on September 1, 2024

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.

elalemanyo avatar elalemanyo commented on September 1, 2024

@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.

jwoertink avatar jwoertink commented on September 1, 2024

@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.

elalemanyo avatar elalemanyo commented on September 1, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.