Skip to content

Commit da7f3f9

Browse files
committed
Feature: Added Suport For Column Wise Search And Gloabal Search , Filtering Data From Frontend, Server Side Export To Different File Formats
1 parent 10fafa3 commit da7f3f9

File tree

12 files changed

+682
-274
lines changed

12 files changed

+682
-274
lines changed

README.md

Lines changed: 64 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,89 @@
1+
<p align="center">
2+
<img src="https://github.com/iYogesharma/datatable-laravel/blob/master/logo.png" /></p>
3+
14
[![Latest Stable Version](https://poser.pugx.org/iyogesharma/datatable-laravel/v/stable)](https://packagist.org/packages/iyogesharma/datatable-laravel)
25
[![Total Downloads](https://poser.pugx.org/iyogesharma/datatable-laravel/downloads)](https://packagist.org/packages/iyogesharma/datatable-laravel)
36
[![License](https://poser.pugx.org/iyogesharma/datatable-laravel/license)](https://packagist.org/packages/iyogesharma/datatable-laravel)
47

5-
# jQuery Datatables For Laravel 5.x
8+
# jQuery Datatables For Laravel
69
A simple package to ease datatable.js server side operations
710

811
This package is created to handle [server-side](https://www.datatables.net/manual/server-side) and [client-side](https://www.datatables.net/manual) works of [DataTables](http://datatables.net) jQuery Plugin via [AJAX option](https://datatables.net/reference/option/ajax) by using Eloquent ORM, Query Builder or Collection.
912

1013

11-
## datatable-laravel 2.0
14+
## datatable-laravel 4.x
1215

13-
Version 2.0 continues the improvements in version 1.0.3 by introducing some new functions , improved code structure and various bug fixes.
16+
Version 4.x continues the improvements in version 3.x by introducing some new features
1417

1518
## New
1619

17-
Introduced three new functions for the case if you know
18-
query is instance of which class. Currently supported include:
19-
Eloquent Query Builder, Database Query Builder and Eloquent Collection
20-
21-
```php
22-
23-
echo datatable()->eloquent(User::query())->init();
24-
echo datatable()->collection(User::query())->init();
25-
echo datatable()->queryBuilder(User::query())->init();
26-
27-
```
20+
- Added support for select raw queries
21+
22+
- Auto guess column names if no columns are provided in request
23+
24+
- Auto guess column names if * is provided in column names
25+
26+
- Added support for group by and havig clause
27+
28+
- Example
29+
```php
30+
echo datatable(User::select('users.name','users.email','users.contact_no','users.role_id')
31+
->selectRaw("
32+
Max(id) as total
33+
")
34+
->groupBy('users.name', 'users.email', 'users.contact_no'))->init();
35+
36+
echo datatable(User::select('users.*'))->init();
37+
```
38+
39+
40+
- Added Support For Data Filtering From Client Side
41+
- Added Column Wise Search Query Support Using Below Api
42+
- Example
43+
```json
44+
{
45+
"columns": [
46+
{
47+
"data": "name",
48+
"name": "name",
49+
"searchable": true,
50+
"orderable": true,
51+
"search": {
52+
"value": "",
53+
"regex": false
54+
}
55+
}
56+
],
57+
"start": 0,
58+
"length": 10,
59+
"search": {
60+
"value": "Yoges",
61+
"regex": false
62+
},
63+
"filters": {
64+
"role_id" : [1,2],// role id in 1,2
65+
"created_at": [date1, date2], // createde at is between date1 and date2,
66+
"name": "iyogesh" // where name = iyogesh
67+
}
68+
}
69+
70+
```
2871

2972
## Modified
3073

31-
Modified make and datatable function . Second parameter here is boolean
32-
with default to false indicate whether you want json response or not.
33-
If you don't pass second parameter then you need to use init() function
34-
as we are using in previous version.
74+
Modified datatable function to support server side export to xls,csv and json
3575

36-
```php
76+
You just need to pass 2 new arguments in query-string/body `export` and ` ext `
3777

38-
echo datatable()->make(User::query(),true);
39-
echo datatable(User::query(),true);
78+
if ` export = true ` it will return download file response
79+
for `ext` default value is `xlsx`
4080

81+
```javascript
82+
https://datatable-url?export=true&ext=xlsx
4183
```
4284

4385

86+
4487
## Using Helper Function
4588

4689
```php

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"datatable",
77
"laravel"
88
],
9-
"version": "3.6.2",
9+
"version": "4.0",
1010
"license": "MIT",
1111
"authors": [{
1212
"name": "Yogesh Sharma",
@@ -50,7 +50,7 @@
5050
}
5151
},
5252
"branch-alias": {
53-
"dev-master": "3.x-dev"
53+
"dev-master": "4.x"
5454
}
5555
}
5656
}

logo.png

14.1 KB
Loading

0 commit comments

Comments
 (0)