[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Proposal for a new dynatable block



Hi Chris,

Much of what came of the API was indeed in this mail. We discussed most of the adjustments in chat sessions, so, the comments you solicited below were discussed.


Bye,


Erik.

On Thu, Mar 15, 2012 at 3:31 AM, Chris Travers <..hidden..> wrote:
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

------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Ledger-smb-devel mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-devel