Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in
  • W wikiwfs.geo.uu.nl
  • Project information
    • Project information
    • Activity
    • Members
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Infrastructure Registry
  • Wiki
    • Wiki
  • Activity
Collapse sidebar
  • System Projects
  • wikiwfs
  • wikiwfs.geo.uu.nl
  • Wiki
  • ajaxTables

ajaxTables · Changes

Page history
Update ajaxTables authored Sep 30, 2021 by 3537390's avatar 3537390
Show whitespace changes
Inline Side-by-side
ajaxTables.md
View page @ 74f5e658
......@@ -3,12 +3,71 @@
\
**function ajaxTable(object: $sqlParams, \[object: $tableParams\]) {}**
> `ajaxTable($sqlParams, $tableParams) { $sqlParams = array_merge( array('db' => '', 'table' => '', 'columns' => '', 'offset' => '', 'limit' => ''), $sqlParams ); $tableParams = array_merge( array('caption' => '', 'columnNames' => $sqlParams['columns'], 'preview' => 3, 'expanded' => false, 'href' => true, 'totalrecords' => true, 'add' => true), $tableParams ); }`
```
ajaxTable($sqlParams, $tableParams) {
$sqlParams = array_merge(
array('db' => '', 'table' => '', 'columns' => '', 'offset' => '', 'limit' => ''),
$sqlParams
);
$tableParams = array_merge(
array('caption' => '', 'columnNames' => $sqlParams['columns'], 'preview' => 3, 'expanded' => false, 'href' => true, 'totalrecords' => true, 'add' => true),
$tableParams
);
$tablestart = '<table>';
$caption = '<caption>'.$tableParams["caption"].'</caption>';
$thead = '<thead></thead>';
$tbody = '<tbody></tbody>';
$tfoot = '<tfoot></tfoot>';
$tableend = '</table>';
$table = $tablestart.$caption.$thead.$tbody.$tfoot.$tableend;
return $table;
}
```
## ajaxTables.js
### Object init
```
<table class="table table-hover table-ajax
data-ajax="" string
data-url="" string
data-db="" string
data-table="" string
data-columns="" string || array
data-table-caption="" string
data-table-preview="" int
data-table-expanded="" bool
data-table-add="" bool
data-table-column-names="" string || array
data-table-column-sortable="" bool || array
data-table-row-href="" bool
data-table-row-events="" array
></table>
```
```
element.dataset.ajax = String: "table";
element.dataset.url = String: "https://wikiwfs.geo.uu.nl/api";
element.dataset.db = String: "llg";
element.dataset.table = String: "llg_nl_boreholeheader";
element.dataset.columns = String: "*" || Array: "['yeargroup,year,names,n_boreholes,minxco,maxxco,minyco,maxyco']";
element.dataset.tableCaption = String: "";
element.dataset.tablePreview = Int: "" / 3;
element.dataset.tableExpanded = Bool: true/false;
element.dataset.tableAdd = Bool: true/false;
element.dataset.tableColumnNames = String: ""/null;
element.dataset.tableColumnSortable = Bool: true/false || Array: "['true,true,false,false,true,true,true,true']";
element.dataset.tableRowHref = Bool: true/false;
element.dataset.tableRowEvents = Array: "['mouseover,mouseout,mousedown,mouseup,click']";
```
### Object functions
**get Dataset() { return this.element.dataset; }**
......@@ -26,4 +85,4 @@ Returns the index of the current Object
Returns the data of the current Object in JSON format
\
**eventReceiver(e, i) {}**
\ No newline at end of file
**eventReceiver(string: event, int: i) {}**
\ No newline at end of file
Clone repository
  • WikiWFS
  • ajaxMenus
  • ajaxTables
  • Home