table_class
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
table_class [2020/08/07 12:34] – sahl | table_class [2021/03/18 21:20] (current) – sahl | ||
---|---|---|---|
Line 18: | Line 18: | ||
===== Datarecord convenience ===== | ===== Datarecord convenience ===== | ||
- | The easiest way to work with [[Datarecord class|Datarecord]] is using the [[DatarecordEditComplex class]], | + | There are three main ways to integrate |
+ | |||
+ | Stepping down a notch is the '' | ||
+ | |||
+ | The most manual | ||
<code php index.php> | <code php index.php> | ||
Line 29: | Line 33: | ||
<code php data.php> | <code php data.php> | ||
// Get all data | // Get all data | ||
- | $filter = new Platform\Filter(DATARECORD CLASS NAME); | + | $filter = new Filter(DATARECORD CLASS NAME); |
$collection = $filter-> | $collection = $filter-> | ||
Line 38: | Line 42: | ||
</ | </ | ||
+ | ===== Filtering data ===== | ||
+ | |||
+ | For both the DatarecordEditComplex and the getTableForClass configuration above, there is an easy built-in way to filter data, and that is by attaching a filter to the table like this: | ||
+ | |||
+ | <code php> | ||
+ | $filter = new Filter(DATARECORD CLASS NAME); | ||
+ | $filter-> | ||
+ | |||
+ | $table-> | ||
+ | </ | ||
+ | |||
+ | This will apply the filter to the table when displaying. | ||
+ | |||
+ | If you provide your own data url, you can also easily modify it to comply to such a filter. Just decode it from the POST like this: | ||
+ | |||
+ | <code php> | ||
+ | $filter = Filter:: | ||
+ | </ | ||
+ | |||
+ | which will yield the same filter as passed into the table. | ||
+ | |||
+ | ===== Actionbuttons ===== | ||
+ | |||
+ | As a convenience one can easily add an // | ||
+ | |||
+ | < | ||
+ | $table-> | ||
+ | </ | ||
+ | |||
+ | The following will add an icon of an open envelope on each row, and each time it is clicked, the javascript function '' | ||
+ | |||
+ | ===== Selecting items ===== | ||
+ | |||
+ | In order to display checkboxes next to each data row, one can call the '' | ||
+ | |||
+ | <code php> | ||
+ | $table-> | ||
+ | </ | ||
+ | |||
+ | This will render checkboxes next to each table row. | ||
+ | |||
+ | These checked values can be retrieved from javascript using the '' | ||
+ | |||
+ | ===== Providing a search form ===== | ||
+ | |||
+ | It is possible to integrate a search form into the table, if one also writes the data url. A form can easily be added to the table by doing this: | ||
+ | |||
+ | <code php> | ||
+ | $form = new Form(' | ||
+ | |||
+ | $table-> | ||
+ | $table-> | ||
+ | </ | ||
+ | |||
+ | This will prevent the table from displaying data before the form is submitted and the content of the form will be posted to the data URL, so one can perform the search server side: | ||
+ | |||
+ | <code php data.php> | ||
+ | ... | ||
+ | $filter = new Filter(DATARECORD CLASS NAME); | ||
+ | $form = new Form(' | ||
+ | if ($form-> | ||
+ | $values = $form-> | ||
+ | $filter-> | ||
+ | } | ||
+ | $collection = $filter-> | ||
+ | |||
+ | $result = Table:: | ||
+ | </ | ||
+ | |||
+ | ===== Searching results ===== | ||
+ | |||
+ | It is possible to use a form field for searching through the results already displayed in the table. In order to do this attach the form field using '' | ||
+ | |||
+ | ===== Tabulator options ===== | ||
+ | Native tabulator options can be passed to the table from PHP, by using the '' |
table_class.1596803651.txt.gz · Last modified: 2020/08/07 12:34 by sahl