[windup-dev] Generic DOM elements sorting JS function

Ondrej Zizka ozizka at redhat.com
Mon Jun 20 18:23:40 EDT 2016


Devs,

I've added a JS function which can sort any elements like this:

         $("body.viewAppList .apps .real 
.appInfo").sortElements(function(a, b){
             return $(a).find(".traits .fileName").first().text().trim() 
 > $(b).find(".traits .fileName").first().text().trim() ? 1 : -1;
         });

So you can give it any set of non-nested elements (but even at different 
levels in the DOM) and have them sorted by the comparer you provide.

Perhaps it could even help with the Migration Issues report complexity, 
not sure.

<script src="reports/resources/js/windup-utils.js"></script>

Enjoy :)


More information about the windup-dev mailing list