%3 ::xotcl::Object ::xotcl::Object ::Generic::List ::Generic::List ::Generic::List->::xotcl::Object

Class ::Generic::List

::Generic::List[i] create ... \
           [ -actions (default "") ] \
           [ -bulk_action_click_function (default "") ] \
           [ -bulk_action_export_vars (default "") ] \
           [ -bulk_action_method (default "post") ] \
           [ -bulk_actions (default "") ] \
           [ -caption (default "") ] \
           [ -checkbox_name (default "") ] \
           [ -class class ] \
           [ -create_url (default "") ] \
           [ -delete_template (default "") ] \
           [ -delete_url (default "") ] \
           [ -edit_template (default "") ] \
           [ -edit_url (default "") ] \
           [ -elements elements ] \
           [ -filters (default "") ] \
           [ -formats (default "") ] \
           [ -html (default "") ] \
           [ -html_class (default "") ] \
           [ -html_main_class (default "") ] \
           [ -html_sub_class (default "") ] \
           [ -name (default "[namespace tail [self]]") ] \
           [ -no_create_p (default "f") ] \
           [ -no_data (default "") ] \
           [ -no_delete_p (default "f") ] \
           [ -no_edit_p (default "f") ] \
           [ -orderby (default "") ] \
           [ -orderby_name (default "") ] \
           [ -package_id (default "") ] \
           [ -page (default "1") ] \
           [ -page_groupsize (default "10") ] \
           [ -pass_properties (default "") ] \
           [ -row_code (default "") ] \
           [ -rows_per_page (default "30") ] \
           [ -selected_format (default "") ] \
           [ -ulevel (default "1") ]

Simple OO interface to template::list. This class has been built to allow quick creation of list UIs for generic acs_objects.

Many parameters are homonymous to those for template::list::create and work in the same way, unless stated differently in this documentation.

Despite the high number of object's members, most of them are there for backward compatibility with the procedural API and they seldom need to be specified.

An example of instantiation could just look as this:

    # Must be an existing acs_object class on the system.
    set class "::dev::Location"

    # As we are talking about acs_objects, our 'delete'
    # page could of course be the same for every object
    # in the system.
    ::Generic::List create list1  -class $class  -package_id $package_id  -rows_per_page $rows_per_page  -delete_url "../delete"  -elements {
          name {
            label "Name"
          }
          street {
            label "Street"
          }
          number {
            label "Number"
          }
          city {
            label "City"
          }
          region {
            label "Region"
          }
          country {
            label "Country"
          }
          coords {
            label "Coordinates"
          }
        } -orderby {
          default_value name
          name {
            label "Name"
            orderby_desc "name desc"
            orderby_asc "name asc"
          }
        } -row_code {
          set coords "$latitude $longitude"
        }

    list1 generate
    
...while the ADP template would include this:
    <listtemplate name="list1"></listtemplate>
    
Notice that in this case we didn't have to specify queries, nor populate any multirow by hand: they have come directly from class's data-model. A list built in this way will be paginated automatically.
Documented Parameters:
actions
Behaves as in template::list::create. If missing, can be automatically generated acting on create_url and no_create_p parameters (see below).
bulk_action_method
Behaves as in template::list::create, but will default to POST method, as it is safer with respect to possible high number of query parameters.
elements
Behaves as in template::list::create. It must be possible to build every element either through class's instance members, or programmatically (see row_code below).
rows_per_page
Behaves as template::list::create's page_size parameter. Pagination is automatically for this class. To turn it off, just set this parameter to "" .
row_code
This snippet will be executed for every instance/row in the list, so is similar in spirit to code_block argument for db_multirow. This will allow the user to build programmatically other elements outside object's data model, override edit and delete url and so on. Code will have access to every variable in the caller scope and to each instance's variable.
class
Is the class (descendant of acs_object) for which this list will be built.
no_create_p
Tells to the list we don't want instance creation action button to be built automatically.
create_url
When instance creation url is automatically built, tells the list to which url make it point.
no_edit_p
Tells to the list we don't want instance edit action button to be built automatically.
edit_url
When instance edit element is automatically built, tells the list to which url make it point. Page pointed must accept an item_id parameter, that will be the primary key of edited instance.
edit_template
When instance edit element is automatically built, use this template to build the element.
no_delete_p
Tells to the list we don't want instance delete action button to be built automatically.
delete_url
When instance delete url is automatically built, tells the list to which url make it point. Page pointed must accept an item_id parameter, that will be the primary key of deleted instance.
delete_template
When instance delete element is automatically built, use this template to build the element.
package_id
Is the package for this instance. It has no use for now.
html_class
Behaves as class parameter in template::list::create.
html_main_class
Behaves as main_class parameter in template::list::create.
html_sub_class
Behaves as sub_class parameter in template::list::create.
Author:
Antonio Pisano <antonio@elettrotecnica.it>
Defined in packages/xotcl-core/tcl/generic-procs.tcl

Class Relations

  • class: ::xotcl::Class[i]
  • superclass: ::xotcl::Object[i]