Using DivSelect Widget

On this page:

Defining Children's Fields

In this example we'll be adding the divselect widget to the employee field.
The FIELDS_NOT_NULL constraint is still recommended:

<%method FIELDS_NOT_NULL>name, surname, city</%method>

Adding DivSelect Field

We add the drop-down list for the employee field with employee_FIELD method:

<%method employee_FIELD>
  <& SELF:GenericSelect_FIELD,
     from => 'demo/sel_employees',
     widget => 'divselect',
     width => 200,
     empty => '', empty_descr => '',               # force GenericSelect_FIELD default values
     empty_button => 'Nobody',
     cols => [80,80,60,120,60,60,40],              # demo/employees field widths
     disp_template => q|P[0]+' '+P[1]+' - '+P[4]|, # widget display when closed - P[N] is a field value in the N'th position
     %ARGS &>
<%attr>
  find_select_list => ['=' => '=']     # types of comparison in find menu
  select_from => 'demo/sel_employees'
</%attr>
</%method>

The same way as for previous select widgets we must set the from to refer to the child table demo/sel_employees.

We get the divselect drop-down list:

DivSelect widget.

Here are the divselect template settings:

Parameter Name Description
empty_button The parameter sets the name of the empty field button that will be displayed in the divselect form.
cols The array sets the widths of the fields of the displayed table.
disp_template The disp_template format string is a valid jscript where values are saved in P array.

Topic revision: r8 - 22 Apr 2018, GuidoBrugnara
This site is powered by FoswikiCopyright (©) Leader.IT - Italy P.I. IT01434390223 Privacy policy & use of cookies