Page 1 of 1

Editable ListIconGadget

Posted: Mon Nov 07, 2016 7:42 am
by LuckyLuke
Hi,

Is it possible to make some of the cells in the ListIconGadget editable (and change the look and feel of the edited cells )?

Thanks

Re: Editable ListIconGadget

Posted: Tue Nov 15, 2016 10:28 am
by LuckyLuke
I found some information on
https://dojotoolkit.org/reference-guide ... aGrid.html
Editing cells
A cell can be defined as editable by setting its editable flag to be true. In the markup, this is achieved by adding the attribute editable="true" to the <th> definition.
But it's not working if I add this attribute. :?

Re: Editable ListIconGadget

Posted: Tue Nov 15, 2016 10:30 am
by Peter
LuckyLuke wrote:But it's not working if I add this attribute. :?
do you have a sample-code?

Greetings ... Peter

Re: Editable ListIconGadget

Posted: Tue Nov 15, 2016 12:32 pm
by LuckyLuke
This is a sample code trying to make the ListIconGadget editable.

Code: Select all

EnableExplicit

Enumeration
  #myWindow
  #myListIconGadget
EndEnumeration

Procedure.i GadgetElement(Gadget, UseJquery.b=#True)
  ; by eddy (http://forums.spiderbasic.com/viewtopic.php?p=320#p320)
  Protected gadgetObject=GadgetID(Gadget)
  !return (v_gadgetobject && v_gadgetobject.div)? v_usejquery? $(v_gadgetobject.div):v_gadgetobject.div:null;
EndProcedure

Procedure SetEditable(Gadget)
  Protected G = GadgetElement(Gadget)
  !v_g.find("th").attr("editable", "true");
EndProcedure

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)
SetEditable(#myListIconGadget)

Define Counter

For Counter = 0 To 9
  AddGadgetItem(#myListIconGadget, -1, "FirstColumnValue" + Str(Counter) + #LF$ + "SecondColumnValue" + Str(Counter))
Next

Re: Editable ListIconGadget

Posted: Thu Nov 17, 2016 1:40 pm
by LuckyLuke
I was looking at the wrong docs :oops:
The correct information can be found on:
https://github.com/SitePen/dgrid/blob/v ... /Editor.md

Code: Select all

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, layout.s, Grid, Col

For Counter = 0 To 9
  AddGadgetItem(#myListIconGadget, -1, "FirstColumnValue" + Str(Counter) + #LF$ + "SecondColumnValue" + Str(Counter))
Next

Define GadgetID = GadgetID(#myListIconGadget)
! var grid = v_gadgetid.gadget;
! v_col = grid.column(1);
! v_col.editor = 'text';
But it's still not working... :(

Re: Editable ListIconGadget

Posted: Mon Aug 21, 2023 8:20 am
by goomoo
This is okay.

Code: Select all

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, layout.s, Grid, Col

For Counter = 0 To 9
  AddGadgetItem(#myListIconGadget, -1, "FirstColumnValue" + Str(Counter) + #LF$ + "SecondColumnValue" + Str(Counter))
Next

! document.getElementById("dgrid_0").contentEditable = true;

Re: Editable ListIconGadget

Posted: Fri Aug 25, 2023 6:52 am
by Dirk Geppert
Great, that's simple genius!