need help finding an event to use

7 views
Skip to first unread message

Carl Hussey

unread,
Jul 15, 2016, 4:31:08 AM7/15/16
to select2

I am trying to find out what event I can use to fire after template results have been returned and displayed in the select2 results.

Use Case:

I am using a template to return a placeholder tag in for a users avatar. Once the results (template) has been passed to select2 and is showing, I need to fire a jQuery plugin to replace that tag in the template results with something else.


...
templateResult: formatTool
...


function formatTool(){

var markup = "<div class='select2-result-tool clearfix'>" +
        "<div class='select2-result-tool__avatar'><img class='profile' width='60' height='60' data-name='" + tool.text + "'></div>" +
        "<div class='select2-result-tool__meta'>" +
        "<div class='select2-result-tool__title'>" + tool.text + "</div>";

return markup;
}

After markup has been returned and the formatted results are showing, I need to fire a plugin that replaced the image with something else. This is working fine when I open the results and manually run my command through console but I cant figure out which event I can trigger to do this for me once the results have been returned and displayed.

Any ideas?
Reply all
Reply to author
Forward
0 new messages