Hi, I am using Autocomplete from the following example:
http://paramquery.com/pro/demos/editing_custom and wants to add support for many columns.
The code below supports column books and the countries. How can I add more local? Say that I have two columns (books, author) and I have one variable for each containing the values for Autocomplete.
It seems like the source can be defined in a dynamic way, but how does that syntax work?
source: (ui.dataIndx == "books" ? books : "/pro/demos/getCountries")
Can I add this to the same function below or is it recomended to add a separate function for each column?
var autoCompleteEditor = function (ui) {
var $inp = ui.$cell.find("input");
//initialize the editor
$inp.autocomplete({
source: (ui.dataIndx == "books" ? books : "/pro/demos/getCountries"),
selectItem: { on: true }, //custom option
highlightText: { on: true }, //custom option
minLength: 0
}).focus(function () {
//open the autocomplete upon focus
$(this).autocomplete("search", "");
});
}
BR