I am unable to use
var results =$.ui.autocomplete.filter(collection, extractLast(request.term));
this in a macro
Whereas the same works when inserted inside an html macro on the page.
Error occurred rendering macro is given.
Inside a user macro, the $ symbol is interpreted as the start of a variable, so jQuery code often throws an error. You can either assign a variable to the $ symbol and use it where you would normally use it (like this: ${j}.ui), or simply use "jQuery", which is what I usually do.
So in a user macro, it should look like this:
var results = jQuery.ui.autocomplete.filter(collection, extractLast(request.term));
jQuery is usually wrapped in AJS, so try
var results =AJS.$.ui.autocomplete.filter(collection, extractLast(request.term));
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Tried it.
But It does not work. Gives the same error
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.