i did registered function for custom field rendering with RegisterTemplateOverrides and my custom field render works quite nicely.

Part of the field is input box for autocomplete, my issue is how to register jquery-ui autocomplete for the input box that does not exist jet. I somehow need to do the registration AFTER i return field html. Any ideas?

This is what field render override function returns:

var retHtml = "<input id='shortCat_" + fieldName + "_autocomplete' type='text' />\
        <span class='loading'></span>\
        <div style='border: 5px solid red' id='shoratCatResult'></div><div id='shoratCatResultHidden'></div>";

return retHtml;

So far i'm testing it with "fake" ajax request that on success adds

$("#shortCat_" + fieldName + "_autocomplete").autocomplete({

, but that i not really good solution and i would be glad if you could suggest something that i would not be ashamed of.

Thank you

EDIT: i would like if it was possible to pass parameters (like fieldName ) to the function.

  • Did you try registerInitCallback? – Andrey Markeev Aug 29 '14 at 12:52

Try to put your function into OnPostRender like this:

    OnPostRender: function(ctx) {

as described here:

CSR and form templates

and here:

Modifying ListForm Save & Close button through JsLink

  • Thank you, it is possible to do it that way, but i it would be nicer if there was a way to directly pass parameters to the function. – Evlo Aug 28 '14 at 17:11
  • Well, OnPostRender is an event which doesn't allow to pass parameters. So, you would need to hardcode the fieldname. – Sig Weber Aug 28 '14 at 17:15
  • guess no way around it – Evlo Aug 29 '14 at 17:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.