I’d like a graphical container that I can add and remove my custom widgets to where I can set a sort function that is automatically applied when these operations take place.
Is there a suitable object in Dojo already that I’ve missed? Or maybe I’m not thinking about the problem correctly?
If not, are there any examples etc. of a minimal working custom container widget out there?
Dont think there is really – how would a standard component’s sort functionality know, with which parameters it should weight the order, when containers can contain any widget type?
Using a layout widget extension would be your best option imho. They each have a function to add children, following this prototype:
The
dijit.layout.StackContaineris a good starting point, it inherits fromdijit._Container(anddijit.layout._LayoutWidget). So you choose when to call the extension functionality of your override.But be aware, that layoutwidgets has more to it then choosing order, also positioning like with bordercontainer’s region parameter.