autocomplete search key specify

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


autocomplete search key specify



By default autocomplete in ace editor picks up value for search and value for substituting in the text field. Can we specify a name for search and value for substitution? Any help is appreciated.



eg for completor


var completer = {
getCompletions: function(editor, session, pos, prefix, callback) {
var f = [
{'value': '2', 'name': 'two'},
{'value': '3', 'name': 'three'},
{'value': 'four', 'name': '4'}
];
callback(null, f);
}
};



In this example, the only value is used for the search. I want to show customers a verbose text during popup but when he/she hits select value should be substituted.





You want to show the user an autosuggestion list and then once the user clicks on any of the items you want to substitute the word with another word right?
– Harsha pps
2 days ago





yes. for eg if the user clicks on two then 2 will be substituted.
– arun6582
yesterday





you mean like {'value': 'two', 'name': '2'} but done automatically and vice versa?
– Joe DF
yesterday


{'value': 'two', 'name': '2'}




1 Answer
1



You could use the insertmatch function inside your autocompleter, and then when the user clicks on two substitute the value with 2


insertMatch: function(editor, data) {
var insertedValue = data.value;
if(insertedValue === "two") {
//Make the required changes here
}
}






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

How to scale/resize CVPixelBufferRef in objective C, iOS

Stripe::AuthenticationError No API key provided. Set your API key using “Stripe.api_key = ”

SVG with two text elements. When one resizes due to textLength - how to resize the other one to the same character size