ad_table

EveAndersson.com : API Browser : ad_table

ad_table

ad_table [ -Torder_target_url Torder_target_url ] \
    [ -Torderby Torderby ] [ -Tasc_order_img Tasc_order_img ] \
    [ -Tdesc_order_img Tdesc_order_img ] \
    [ -Tmissing_text Tmissing_text ] [ -Tsuffix Tsuffix ] \
    [ -Tcolumns Tcolumns ] [ -Taudit Taudit ] \
    [ -Trows_per_band Trows_per_band ] [ -Tband_colors Tband_colors ] \
    [ -Trows_per_page Trows_per_page ] [ -Tmax_rows Tmax_rows ] \
    [ -Ttable_extra_html Ttable_extra_html ] \
    [ -Theader_row_extra Theader_row_extra ] \
    [ -Ttable_break_html Ttable_break_html ] \
    [ -Tpre_row_code Tpre_row_code ] [ -Trow_code Trow_code ] \
    [ -Tpost_data_ns_sets Tpost_data_ns_sets ] \
    [ -Textra_vars Textra_vars ] [ -bind bind ] statement_name sql_qry \
    Tdatadef
Defined in packages/acs-core/table-display-procs.tcl

Note: all the variables in this function are named Tblah since we could potentially have namespace collisions

build and return an html fragment given an active query and a data definition.

  • sql_qry -- The query that should be executed to generate the table.
    You can specify an optional -bind argument to specify a ns_set of bind variables.
  • Tdatadef -- the table declaration.
Datadef structure :
 
    { 
        {column_id "Column_Heading" order_clause display_info}
        ...
    }
    
  • column_id -- what to set as orderby for sorting and also is the default variable for the table cell.
  • the text for the heading to be wrapped in <th> and </th> tags. I am not entirely happy that things are wrapped automatically since you might not want plain old th tags but I also don;t want to add another field in the structure.
  • order_clause -- the order clause for the field. If null it defaults to "column_id $order". It is also interpolated, with orderby and order defined as variables so that:
                 {upper(last_name) $order, upper(first_names) $order}
             
    would do the right thing.

    the value "no_sort" should be used for columns which should not allow sorting.

    the value "sort_by_pos" should be used if the columns passed in are column positions rather than column names.

  • display_info. If this is a null string you just default to generating <td>column_id</td>. If it is a string in the lookup list then special formatting is applied; this is l r c tf 01 for align=left right center, Yes/No (from tf), Yes/No from 0/1.

    if the display stuff is not any of the above then it is interpolated and the results returned (w/o any <td> tags put in). An example:

        set table_def { 
            {ffn "Full Name" 
                {upper(last_name) $order, upper(first_names) $order}
                {<td><a href="/admin/users/one.tcl?user_id=$user_id">$first_names $last_name</a></td>}}
            {email "e-Mail" {} {<td><a href="mailto:$email">$email</a>}}
            {email_bouncing_p "e-Bouncing?" {} tf}
            {user_state "State" {} {}}
            {last_visit "Last Visit" {} r}
            {actions "Actions" no_sort {<td>
                    <a href="/admin/users/basic-info-update.tcl?user_id=$user_id">Edit Info</a> | 
                    <a href="/admin/users/password-update.tcl?user_id=$user_id">New Password</a> |
                [ad_registration_finite_state_machine_admin_links $user_state $user_id]}}
        }
        

Switches:
-Torder_target_url (optional)
-Torderby (optional)
-Tasc_order_img (defaults to "^")
-Tdesc_order_img (defaults to "v")
-Tmissing_text (defaults to "No data found.")
-Tsuffix (optional)
-Tcolumns (optional)
-Taudit (optional)
-Trows_per_band (defaults to "1")
-Tband_colors (defaults to "{} {"#ececec"}")
-Trows_per_page (defaults to "0")
-Tmax_rows (defaults to "0")
-Ttable_extra_html (optional)
-Theader_row_extra (defaults to "bgcolor="#f8f8f8"")
-Ttable_break_html (defaults to "

")
-Tpre_row_code (optional)
-Trow_code (defaults to "[subst $Trow_default]")
-Tpost_data_ns_sets (optional)
-Textra_vars (optional)
-bind (optional)

Parameters:
statement_name
sql_qry
Tdatadef
[ show source ]

Show another procedure:

eve@eveandersson.com