nnmware / devoops

DevOOPS Bootstrap 3 Admin theme
GNU General Public License v3.0
852 stars 416 forks source link

Multiple scripts load and execution #37

Closed vzr314 closed 8 years ago

vzr314 commented 9 years ago

This is scenario: Click on "Messages" icon several times, than click on "Inbox" and see what is happening.

@devoopsme You can not load ajax-content the way you did here: every ajax-page which contains javascripts, will be executed on first load of .ajax-content, and every next load after that will result in re-execution of those scripts, which often lead to multiple load of plugins (i.e datatables, xchart...) and multiple script executions, and messing whole app. To fix this, one may use 3rd party script loader (RequireJS, YepNope) and rewrite your devoops.js ajax-loader. You must use conditional script loader instead of loading HTML DOM with jQuery $(selector).html("content");

There is also other approach without 3rd party JS plugins, but it would require switching to AngularJS, because this issue is result of jQuery limitations.

devoopsme commented 8 years ago

Need make changes for every individual projects. Now- devoops theme- it's only template. Can't make universal solution. But can make base template