[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Proposal for a new dynatable block
- Subject: Proposal for a new dynatable block
- From: Chris Travers <..hidden..>
- Date: Wed, 14 Mar 2012 19:31:38 -0700
Hi all;
I have refactored dynatable from form-dynatable.html for 1.4 and
copied the file back to 1.3 for use in search routines. Now I am
proposing essentially an API for this block. This is based somewhat
on the way things work now but also different in key areas.
The idea is that the dynatable block would accept the following parameters:
$table_class = $class
$part is either thead, tbody, or tfoot. These can all be applied here.
form = $bool
$part = {
display_header = $bool
columns = [
{ name = $name
type = $type # see below
col_id = $col_id
class = $class
href_base = $href_base # only if type = href
}
];
Type would be one of text (straight text), href (hyperlink), radio
(radio button), checkbox (checkbox), text_input (input box). I don't
think we need to support select dropdowns a the moment, and if we do,
we could add this later. Currently I don't see a need for more items
than this.
rows = [
row_id = $row_id
row_class = $row_class
${col_name}_href_suffix =
....
];
Other attributes are the values for the columns based on column_name.
This means that row_id essentially becomes a reserved word in
LedgerSMB.
The table would be then be generated with thead, tbody, and tfoot elements.
Each part would display a header if display_header is true:
Columns names would appear with class = "dynatable-header $col_id"
Rows:
If table.form is true, then include a hidden row_id_$rownum input with
$row_id as the value.
For each column:
if type = text, just display value.
if type = 'href' display hyperref. Hyperref is to href_base, and
if ${col_name}_href_suffix is declared for this row, append it, if
not, append row_id.
if type = 'radio', display radio button. Submit row_id back if selected
if type = 'checkbox', display checkbox. name is
"${col_name}_$row_number" with $row_id submitted back as the value
if type = 'input_text', display an input box, naed
"${col_name}_$row_id" fill it out with the value provided.
Each cell would have a "$col_id" class.
This would, I think, simplify the API for creating tables, and make
the API more useful for new code.
Any suggestions or feedback?
Best Wishes,
Chris Travers