jquery_chained icon indicating copy to clipboard operation
jquery_chained copied to clipboard

Added an event to listen too after json loaded

Open jcphlux opened this issue 10 years ago • 3 comments

I added a trigger to the getJSON so I could listen to the event.

Changes - request = $.getJSON(settings.url, data, function(json) { build.call(self, json); /* Force updating the children. */ $(self).trigger("change"); $(self).trigger("dataLoaded", [self]); });

Usage - $("target_select").on("dataLoaded", function (e) { //do stuff. });

jcphlux avatar Feb 24 '15 17:02 jcphlux

+1

I also need this but the event name should be namespaced to avoid collisions with other libraries. Maybe the event should be named load.chained.remote.

Will try to prepare a PR.

sargue avatar Sep 01 '15 08:09 sargue

Well, I've forked the project, made the change, created a test and... works ok with jQuery, fails miserably with Zepto.

Seems that the problem is on the event name.

If I use load.chained.remote as the event name it works only with jQuery. If i use customloadevent as the event name it works everywhere.

I am far from being an expert, so googling about this I found a related article with helpful comments. I'm sending the PR with the event named as chaned:load but suggestions are very welcome.

sargue avatar Sep 18 '15 14:09 sargue

that feature should be integrated into the project

psohm avatar Apr 04 '17 14:04 psohm