below there is a (cumbersome) snippet to detect if a columnheader was clicked (for example to sort the displayed data).
I wonder, how to determine the underlying dgrid-Object for an easy access to all dgrid-functionalities.
Code: Select all
EnableExplicit
Enumeration
#myWindow
#myListIconGadget
EndEnumeration
OpenWindow(#myWindow, #PB_Ignore, #PB_Ignore, 800, 600, "ListIconGadget", #PB_Window_ScreenCentered)
ListIconGadget(#myListIconGadget, 10, 10, WindowWidth(#myWindow) - 20, WindowHeight(#myWindow) - 20, "FirstColumn", 100)
AddGadgetColumn(#myListIconGadget, 1, "SecondColumn", 100)
Define Counter
For Counter = 0 To 9
AddGadgetItem(#myListIconGadget, -1, "FirstColumnValue" + Str(Counter) + #LF$ + "SecondColumnValue" + Str(Counter))
Next
Define GadgetID = GadgetID(#myListIconGadget)
Define SelectedColumn
! $(v_gadgetid.div).find(".dgrid").find(".dgrid-header-row").find("th").on("click", function(e) {
! v_selectedcolumn = $(e.currentTarget).index();
Debug "HeaderClick detected!"
Debug "SelectedColumn: " + Str(SelectedColumn)
! });