|
Hello All! how can I sort QxListItems in a QxList? Lets say we have a QxList with QxListItem children. My thoughts were: window.application.main = function() { var list = new QxList(); list.set({top:50,left:50}); list.add(new QxListItem('Will')); list.add(new QxListItem('Anna')); list.add(new QxListItem('Tom')); list.add(new QxListItem('Diana')); list.add(new QxListItem('Pete')); function qxlistitemCompare (a,b) { var av = a.getLabel(); var bv = b.getLabel(); return av < bv ? -1 : ( av == bv ? 0 : 1 ); } var btn = new QxButton('Sort'); btn.set({top:50,left:200}); btn.addEventListener('click',function(e){ var items = list.getChildren(); items.sort(qxlistitemCompare); for(var i=0;i<items.length;i++) { list.add(items[i]); } }); this.add(btn); this.add(list); }; The array is sorted correctly but the problem seems to be that re-adding the items to the list is not enough to enforce a resorting or recreation of the items. Any Ideas what I have to do to make it work? 2 Cents are welcome ;-) Thank you. Regards. -- Mit freundlichen Grüßen Dietrich Streifert Visionet GmbH |
Introducing QxListView.
Reimplementation not completed. This is only a technical demo.
