Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/monkenWu/TablesIgniter
Tableslgniter is an addins base on CodeIgniter4. It will help you use jQuery Datatables in server side mode.
https://github.com/monkenWu/TablesIgniter
ci4 codeigniter4 datatables-serverside jquery-datatables library
Last synced: 2 months ago
JSON representation
Tableslgniter is an addins base on CodeIgniter4. It will help you use jQuery Datatables in server side mode.
- Host: GitHub
- URL: https://github.com/monkenWu/TablesIgniter
- Owner: monkenWu
- License: mit
- Created: 2020-01-21T11:06:01.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2022-07-18T00:55:22.000Z (over 2 years ago)
- Last Synced: 2024-10-31T08:12:07.463Z (2 months ago)
- Topics: ci4, codeigniter4, datatables-serverside, jquery-datatables, library
- Language: PHP
- Homepage: https://tablesigniter.monken.tw/
- Size: 239 KB
- Stars: 14
- Watchers: 1
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: contributing.md
- License: LICENSE
Awesome Lists containing this project
- awesome - monkenWu/TablesIgniter - Tableslgniter is an addins base on CodeIgniter4. It will help you use jQuery Datatables in server side mode. (PHP)
README
# TablesIgniter
[![Latest Stable Version](https://poser.pugx.org/monken/tablesigniter/v)](//packagist.org/packages/monken/tablesigniter) [![Total Downloads](https://poser.pugx.org/monken/tablesigniter/downloads)](//packagist.org/packages/monken/tablesigniter) [![License](https://poser.pugx.org/monken/tablesigniter/license)](//packagist.org/packages/monken/tablesigniter)
Tableslgniter is an addins base on CodeIgniter4. It will help you use jQuery Datatables in server side mode.
If you want to get CodeIgniter3 version of Tableslgniter you can go to this [git repository](https://github.com/monkenWu/TablesIgniter_CI3).
[Visit the sample website and read user guide.](https://tablesigniter.monken.tw/)
TablesIgniter 基於 CodeIgniter4 。它將可以幫助你在 使用 server side mode 中使用 jQuery Datatables。
如果你希望取得 CodeIgniter3 版本的 Tableslgniter 你可以前往這個 [git儲存庫](https://github.com/monkenWu/TablesIgniter_CI3) 。
[造訪範例網站與使用指南](https://tablesigniter.monken.tw/)
## Install
### Prerequisites
1. CodeIgniter Framework 4.*
2. Composer### Composer Install
```
composer require monken/tablesigniter
```
### Use LibraryDeclare the following code in the controller that will use TablesIgniter.
```
use monken\TablesIgniter;
```## Quick Start
### HTML
```
id
title
date
```
### JavaScript
```
$('#firstTable').DataTable({
"aoColumnDefs": [{
"bSortable": false,
"aTargets": [ 0,1,2 ]
}],
"order":[],
"serverSide":true,
"searching": false,
"lengthChange":false,
"ajax":{
url:"=base_url('home/firstTable')?>",
type:'POST'
}
});
```### Controller
```
public function firstTable(){
$model = new HomeModel();
$table = new TablesIgniter();
$table->setTable($model->noticeTable())
->setOutput(["id","title","date"]);
return $table->getDatatable();
}
```1. Calling the "setTable()" method must pass in a Query Builder object. TablesIgniter relies on the database query content defined by this object. This object is usually declared in the Model.
2. When calling the "setOutput()" method, the array must be passed in. The order of the array will affect the order of the data presented by DataTables. The definition of the string must be the same as the field name of the result queried by "setTable()".
3. Calling "getDatatable()" will get the json string that meets the requirements of jQuery DataTables.
### Model
```
public function noticeTable(){
$builder = $this->db->table("news");
return $builder;
}
```You are free to use all the methods of Query Builder to meet all your requirements for database query. Finally, you must return the objects generated by Query Builder.