Select control search on the basis of data fields - javascript

Currently I am using Jquery Chosen Plugin in order to search the values written inside a search box and it works very well in case I want to search on the basis of the text written inside the option tag. i.e. as shown in the figure:
But what I want to achieve is search on the multiple basis i.e. on the basis of the text written inside the option tag as well as the data attributes of the option tag i.e.
For example in the above figure I may be able to search Debitors either by typing Debitors directly or by typing the data-phone's value i.e.0321-111111. I've searched the chosen plugin's documentation for the possibility to search on the basis of multiple values but, as much as I know, there wasn't any functionality provided by it.
Now what I'd like to ask is, Is there any jQuery plugin providing this multisearch functionality that you may know of?
Thanks.

Finally, I found Select2 Jquery plugin that allows the custom matcher for the searching. i.e. You can define whatever you want plugin's search to search.

Related

JavaScript package to create a search bar like Kibana

Does anyone know a JavaScript package that allows to create a multi-keyword filter query like for example the searchbar of Kibana. StackOverflow, Trello and Gitlab have similar capabilities, but not all have support for multiple filters at once or don't have autocomplete for all possible search filters.
I am looking for something similar to select2 with tags, but then the predefined options are all the available filters and after selecting a filter you can enter the desired value. For instance, you enter "user:" after which you can select one of your users. This will then result in "user:John" in your search bar (and underneath it keeps track of the user id for the actual search). Next you can add another filter etc. resulting in powerfull search queries while using just one search box.
Also see this Kibana search example:
I am just wondering what already exists, before I start making this.

Multiple Key Value Query Search Input Box

I'm not quite sure exactly what to search for or where exactly to start, but I'm trying to see if it's possible to have a customized search box for multiple GET queries simply using jQuery, JS, HTML and CSS.
The user would first type in something which will prompt the red box to show (key) and it would autofill with a listed default given the first few characters they typed. Then upon pressing enter or tab, they would be allowed to fill in the answer gray box (value). Then after, they can either choose to submit or put in another key / value.
Is there a jQuery library that already has this implemented, and is this even possible? I thought about putting input boxes inside the input search box and using jQuery to hide and show them depending on what they type, but is that the best way?
I'd like to do this without comprehensive framework / library like Angular and React.
Thanks in advance!
You must handle it with one of JavaScript freamworks like Vue.js, React.js or Angular.js

Selecting more than one value without checkboxes

Currenty I am using checkboxes to select more than one value in a form. So when creating a new post I can select all the categories it falls into. But the cat list is getting longer and is becoming a bit unmanagable.
I like how wordpress adds tags to each post via ajax. Wordpress has a text input field with autocomplete, you just start typing and then if it's already there (in the db) then it'll show and get adding to a list dynamically. If it's not found in the list then it gets inserted on form submit.
How can I achieve this or similar so that I don't have to use x amount of checkboxes?
Check out this jQuery library. It works on multi selects instead of checkboxes, but the logic and result is exactly what you need.
http://harvesthq.github.io/chosen/
(not affiliated, I've just used it a few times)
One option would be to make use a library such as jquery-autocomplete
https://www.devbridge.com/sourcery/components/jquery-autocomplete/
This makes use of AJAX based functionality and will give you the ability to tweak it based on values stored in a database table. You can make a simple check function that, in the case the value can not be found, the user will have the option to simply press add and insert it into said library.
The rest is jsut a matter of styling and design.

Multiple search options, single field, selected via drop down - js/jquery

I'm trying to essentially create a drop down menu tied to a field that allows me to search multiple sections of the back end of a site by choosing which section to search using the drop down.
What this will entail is assigning a variable to represent the input from the form and scripting to toggle between the different query strings that that variable will be used to complete.
At this point I'm basically just lost as to how to structure the javascript required to accomplish this.
Can I tie each query string to each option using an id and then create a function that runs when the form itself is submitted, constructing the needed query URL by combining the variable with the base URL included in the javascript?
Basically I need, say, the text dropdown selection to tell the page that it will be appending %query% to http://example.com/content/text/?q= when the form is submitted and letting the system handle the rest.
I would sincerely appreciate some input on how to structure the js/jquery to accomplish that. I know I need to tie the variable to the field and the URLs to be completed to the drop down based on ID but I'm not totally sure how.
Here are some jsFiddle examples of what you might want to do:
Pass the search term and dropdown select field in the query string to one page and have the page do something based on the choices. jsFiddle
Pass the search term to a page specified by the dropdown select field. jsFiddle
Pass the search term to a URL specified by the dropdown select field. jsFiddle
This is what I would do.
Have a eventhandler for onsubmit
In YourMehtod(){
1. get dropdown selection
2. get the URL and append query string
3.window.open(url,"_self")
}

Wordpress widget adding variables

I want to add a filter feature to my wordpress widget. For this, I must be able to add as many filters i want. For its implementation, I am adding filter select box and text box to accept filter value, on the fly through javascript.
My problem is;
How can i save these values to widget instance variable. So the next time they should be visible.
How will I access these values for processing.
Please let me know if I am not clear on some point.

Categories