... | @@ -3,12 +3,71 @@ |
... | @@ -3,12 +3,71 @@ |
|
\
|
|
\
|
|
**function ajaxTable(object: $sqlParams, \[object: $tableParams\]) {}**
|
|
**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
|
|
## ajaxTables.js
|
|
|
|
|
|
### Object init
|
|
### 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
|
|
### Object functions
|
|
|
|
|
|
**get Dataset() { return this.element.dataset; }**
|
|
**get Dataset() { return this.element.dataset; }**
|
... | @@ -26,4 +85,4 @@ Returns the index of the current Object |
... | @@ -26,4 +85,4 @@ Returns the index of the current Object |
|
Returns the data of the current Object in JSON format
|
|
Returns the data of the current Object in JSON format
|
|
|
|
|
|
\
|
|
\
|
|
**eventReceiver(e, i) {}** |
|
**eventReceiver(string: event, int: i) {}** |
|
\ No newline at end of file |
|
\ No newline at end of file |