Page 1 of 1

Make ListIcon sortable with this JS library

Posted: Sat Oct 09, 2021 11:26 am
by firace
Hi,

Is it possible to somehow add this JS lib to make a listicon sortable?

https://www.kryogenix.org/code/browser/sorttable/

Code: Select all


CloseDebugOutput()

OpenWindow(0,50,10,1000,600, "Ranglisten" )
ListIconGadget(111,50,10,800,500,"Rang",60, #PB_ListIcon_GridLines)
AddGadgetColumn(111, 1, "Name", 150)  
AddGadgetColumn(111, 2, "Taler",100)  
AddGadgetColumn(111, 3, "Spiele",100)  

r.s=Chr(10)

For i = 1 To 16
  name.s= "aName "+Str(i)
  taler.s = Str(Random(100,1))
  spiele.s = Str(Random(100,1))
  zeile.s=Str(i)+r+name+r+taler+r+spiele
  AddGadgetItem(111,-1,zeile)
Next i  


Re: Make ListIcon sortable with this JS library

Posted: Sat Oct 09, 2021 7:43 pm
by firace
In the meantime I found out that ListIcon is implemented using a dgrid control.
Therefore is there perhaps a simple one-liner to set the sort order?
I tried something like this but without success:

Code: Select all

  Define GadgetID = GadgetID(1)

 ! var grid = v_gadgetid.gadget;
 
 !  grid.set('sort', grid.columns[2]);

Re: Make ListIcon sortable with this JS library

Posted: Sat Oct 09, 2021 8:12 pm
by Paul
If you don't want to reinvent the wheel, Peter has made an excellent ListIcon Module with sort capabilities.
https://github.com/spiderbytes/ListIconGadgetEx

Re: Make ListIcon sortable with this JS library

Posted: Mon Oct 11, 2021 7:41 am
by firace
Awesome! Thanks a lot.