Monday, January 25, 2010

[jQuery] Combine jquery.jeditable.js with jquery.autocomplete.js

Hi,

Someone can suggest me how to write a custom input to
combine "autocomplete" ("http://jquery.bassistance.de/autocomplete/
jquery.autocomplete.js")
functionality with inline editing
of "Jeditable" ("http://www.appelsiini.net/download/
jquery.jeditable.js")?

I want to:
1)set external url to read Json data
2)set dataType = "json"

The option num.1 works, the second no.
how can I pass the parameter "dataType" to "autocomplete library"?

This is my code:
-cut-
$.editable.addInputType('autocomplete', {
element : $.editable.types.text.element,
plugin : function(settings, original) {
$('input', this).autocomplete
(settings.autocomplete.url);
$('input', this).autocomplete(settings.autocomplete.dataType);
}
});
-cut-

-cut-
.....
autocomplete : {
dataType: "json",
url: "test.json"
}
....
-cut-

thanks,

Antonio

No comments: