developer.jelix.org is not used any more and exists only for history. Post new tickets on the Github account.
developer.jelix.org n'est plus utilisée, et existe uniquement pour son historique. Postez les nouveaux tickets sur le compte github.

Opened 10 years ago

Closed 10 years ago

#1147 closed enhancement (fixed)

Allowing to generate optgroup in menulist and listbox

Reported by: laurentj Owned by:
Priority: normal Milestone: Jelix 1.2RC1
Component: jelix:forms Version:
Severity: normal Keywords:
Cc: Blocked By:
Blocking: Documentation needed: no
Hosting Provider: Php version:

Description (last modified by laurentj)

jForms cannot generate optgroup in a menulist or listbox control.

My proposal

XML declaration:

  • for static datasource: new <itemgroup label=""> tag
  • for dao datasource: new groupby attribute, indicating the dao property on which the datasource will group.
  • for class datasource: new groupby attribute, indicating a name. This name will be used by the datasource class, as it wants.

Implementation in datasource classes:

  • a $groupBy property on datasource object, indicating on what we should group values. ("what" depending of the nature of the datasource). ' ' means no group.
  • when this property is set, getData should return an array: keys are group label. values are classical arrays (keys= value of options, values= label of options).
  • when the property is not set, getData returns an array as usual.

Builders: depending the value of $groupBy, they know if they should generate optgroup or not.

Note: we can support this feature on <checkboxes> and <radiobuttons>. Instead of generating <optgroup>, we could generate <fieldset>.

Change History (3)

comment:1 Changed 10 years ago by laurentj

  • Description modified (diff)

comment:2 Changed 10 years ago by Julien

looks good, I need it too ;)

comment:3 Changed 10 years ago by laurentj

  • Milestone set to Jelix 1.2
  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.