midoriTableSelection
midoriTableSelection gives users an easy to way to select the rows of a table by using checkboxes. Checkboxes can be toggled at any time, and the changes will be remembered.
-
midoriTableSelection(vars)Creates a midoriTableSelection object.
Accepts the following parameters:
- tableId is the id of the table.
- rowPrefix is the prefix part of the <tr> ids. The part after the prefix is used as the value for checkboxes.
- checkboxName is the name used for the checkboxes.
- rowHighlight is the row highlight class.
- showCallback is the optional callback function that will be called after the checkboxes are displayed.
- hideCallback is the optional callback function that will be called after the checkboxes are hidden.
Note:The <th> and <td> elements in the table must have class names. These class names are used for the checkbox cells.
Example:var pmSelection = new midoriTableSelection( { tableId: 'pms', rowPrefix: 'pm_', checkboxName: 'pm_ids[]', rowHighlight: 'row-highlight' } ); - tableId is the id of the table.
-
toggle()Toggles the checkboxes in the table.Example:
[Toggle]From Subject John Hello Ann About the article Jim Party [<a href="javascript: pmSelection.toggle()">Toggle</a>] <table id="pms" cellpadding="3" cellspacing="0"> <tr> <th class="pm-header" align="center">From</th> <th class="pm-header" align="left">Subject</th> </tr> <tr id="pm_3"> <td class="pm-row-new" align="center">John</td> <td class="pm-row-new" valign="top">Hello</td> </tr> <tr id="pm_1"> <td class="pm-row-new" align="center">Ann</td> <td class="pm-row-new" valign="top">About the article</td> </tr> <tr id="pm_4"> <td class="pm-row-new" align="center">Jim</td> <td class="pm-row-new" valign="top">Party</td> </tr> </table>
