Make ListIcon sortable with this JS library

Just starting out? Need help? Post your questions and find answers here.
firace
Posts: 28
Joined: Tue Jan 02, 2018 6:59 pm

Make ListIcon sortable with this JS library

Post 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  

firace
Posts: 28
Joined: Tue Jan 02, 2018 6:59 pm

Re: Make ListIcon sortable with this JS library

Post 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]);
User avatar
Paul
Posts: 195
Joined: Wed Feb 26, 2014 6:46 pm
Location: Canada
Contact:

Re: Make ListIcon sortable with this JS library

Post 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
firace
Posts: 28
Joined: Tue Jan 02, 2018 6:59 pm

Re: Make ListIcon sortable with this JS library

Post by firace »

Awesome! Thanks a lot.
Post Reply