├── .gitignore ├── LICENSE ├── README.md ├── composer.json ├── resources ├── assets │ └── dataTables-1.10.19 │ │ ├── dataTables.bootstrap.min.css │ │ ├── dataTables.bootstrap.min.js │ │ ├── jquery.dataTables.min.js │ │ ├── libs │ │ ├── jszip │ │ │ └── jszip.min.js │ │ └── pdfmake │ │ │ ├── pdfmake.min.js │ │ │ └── vfs_fonts.js │ │ └── plugins │ │ ├── buttons │ │ ├── buttons.dataTables.min.css │ │ ├── buttons.html5.min.js │ │ ├── buttons.print.min.js │ │ └── dataTables.buttons.min.js │ │ └── i18n │ │ ├── Afrikaans.lang │ │ ├── Albanian.lang │ │ ├── Amharic.lang │ │ ├── Arabic.lang │ │ ├── Armenian.lang │ │ ├── Azerbaijan.lang │ │ ├── Bangla.lang │ │ ├── Basque.lang │ │ ├── Belarusian.lang │ │ ├── Bulgarian.lang │ │ ├── Catalan.lang │ │ ├── Chinese-traditional.lang │ │ ├── Chinese.lang │ │ ├── Croatian.lang │ │ ├── Czech.lang │ │ ├── Danish.lang │ │ ├── Dutch.lang │ │ ├── English.lang │ │ ├── Estonian.lang │ │ ├── Filipino.lang │ │ ├── Finnish.lang │ │ ├── French.lang │ │ ├── Galician.lang │ │ ├── Georgian.lang │ │ ├── German.lang │ │ ├── Greek.lang │ │ ├── Gujarati.lang │ │ ├── Hebrew.lang │ │ ├── Hindi.lang │ │ ├── Hungarian.lang │ │ ├── Icelandic.lang │ │ ├── Indonesian-Alternative.lang │ │ ├── Indonesian.lang │ │ ├── Irish.lang │ │ ├── Italian.lang │ │ ├── Japanese.lang │ │ ├── Kazakh.lang │ │ ├── Korean.lang │ │ ├── Kyrgyz.lang │ │ ├── Latvian.lang │ │ ├── Lithuanian.lang │ │ ├── Macedonian.lang │ │ ├── Malay.lang │ │ ├── Mongolian.lang │ │ ├── Nepali.lang │ │ ├── Norwegian-Bokmal.lang │ │ ├── Norwegian-Nynorsk.lang │ │ ├── Pashto.lang │ │ ├── Persian.lang │ │ ├── Polish.lang │ │ ├── Portuguese-Brasil.lang │ │ ├── Portuguese.lang │ │ ├── Romanian.lang │ │ ├── Russian.lang │ │ ├── Serbian.lang │ │ ├── Sinhala.lang │ │ ├── Slovak.lang │ │ ├── Slovenian.lang │ │ ├── Spanish.lang │ │ ├── Swahili.lang │ │ ├── Swedish.lang │ │ ├── Tamil.lang │ │ ├── Thai.lang │ │ ├── Turkish.lang │ │ ├── Ukrainian.lang │ │ ├── Urdu.lang │ │ ├── Uzbek.lang │ │ ├── Vietnamese.lang │ │ ├── Welsh.lang │ │ └── telugu.lang └── views │ └── index.blade.php └── src ├── DataTable.php ├── DataTableExtension.php └── DataTableServiceProvider.php /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | phpunit.phar 3 | /vendor 4 | composer.phar 5 | composer.lock 6 | *.project 7 | .idea/ -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2019 jxlwqq 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DataTable for laravel-admin 2 | 3 | **Add advanced interaction controls to your HTML tables** the free & easy way. 4 | 5 | [![996.icu](https://img.shields.io/badge/link-996.icu-red.svg)](https://996.icu) 6 | 7 | ## ScreenShot 8 | 9 | 10 | 11 | ## Install 12 | 13 | ```bash 14 | composer require jxlwqq/data-table 15 | php artisan vendor:publish --tag=laravel-admin-data-table 16 | ``` 17 | 18 | ## Update 19 | 20 | ```bash 21 | composer require jxlwqq/data-table 22 | php artisan vendor:publish --tag=laravel-admin-data-table --force 23 | ``` 24 | 25 | ## Configurations 26 | 27 | Add `extensions` option in your `config/admin.php` configuration file: 28 | 29 | ```php 30 | 'extensions' => [ 31 | 'data-table' => [ 32 | // If the value is set to false, this extension will be disabled 33 | 'enable' => true, 34 | // global options 35 | 'options' => [ 36 | 'paging' => false, 37 | 'lengthChange' => false, 38 | 'searching' => false, 39 | 'ordering' => false, 40 | 'info' => false, 41 | 'language' => 'English', // or Chinese 42 | ] 43 | ] 44 | ] 45 | ``` 46 | 47 | More languages can be found in [DataTable i18n](https://github.com/DataTables/Plugins/tree/master/i18n). 48 | 49 | ## Use 50 | 51 | ```php 52 | use Jxlwqq\DataTable\DataTable; 53 | 54 | // table 55 | $headers = ['Id', 'Email', 'Name', 'Company']; 56 | $rows = [ 57 | [1, 'labore21@yahoo.com', 'Ms. Clotilde Gibson', 'Goodwin-Watsica'], 58 | [2, 'omnis.in@hotmail.com', 'Allie Kuhic', 'Murphy, Koepp and Morar'], 59 | [3, 'quia65@hotmail.com', 'Prof. Drew Heller', 'Kihn LLC'], 60 | [4, 'xet@yahoo.com', 'William Koss', 'Becker-Raynor'], 61 | [5, 'ipsa.aut@gmail.com', 'Ms. Antonietta Kozey Jr.', 'Goooogle'], 62 | ]; 63 | 64 | $style = ['table-bordered','table-hover', 'table-striped']; 65 | 66 | $options = [ 67 | 'paging' => true, 68 | 'lengthChange' => false, 69 | 'searching' => false, 70 | 'ordering' => true, 71 | 'info' => true, 72 | 'autoWidth' => false, 73 | ]; 74 | 75 | $dataTable = new DataTable($headers, $rows, $style, $options); 76 | 77 | echo $dataTable->render(); 78 | ``` 79 | 80 | more options can be found in [DataTable Documentation](https://datatables.net/reference/option/). 81 | 82 | 83 | ## More resources 84 | 85 | [Awesome Laravel-admin](https://github.com/jxlwqq/awesome-laravel-admin) 86 | 87 | ## License 88 | 89 | Licensed under [The MIT License (MIT)](LICENSE). 90 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jxlwqq/data-table", 3 | "description": "dataTable for laravel-admin", 4 | "type": "library", 5 | "keywords": ["laravel-admin", "extension"], 6 | "homepage": "https://github.com/jxlwqq/data-table", 7 | "license": "MIT", 8 | "authors": [ 9 | { 10 | "name": "jxlwqq", 11 | "email": "jxlwqq@gmail.com" 12 | } 13 | ], 14 | "require": { 15 | "php": ">=7.0.0", 16 | "encore/laravel-admin": "~1.6" 17 | }, 18 | "require-dev": { 19 | "phpunit/phpunit": "~6.0" 20 | }, 21 | "autoload": { 22 | "psr-4": { 23 | "Jxlwqq\\DataTable\\": "src/" 24 | } 25 | }, 26 | "extra": { 27 | "laravel": { 28 | "providers": [ 29 | "Jxlwqq\\DataTable\\DataTableServiceProvider" 30 | ] 31 | 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /resources/assets/dataTables-1.10.19/dataTables.bootstrap.min.css: -------------------------------------------------------------------------------- 1 | table.dataTable{clear:both;margin-top:6px !important;margin-bottom:6px !important;max-width:none !important;border-collapse:separate !important}table.dataTable td,table.dataTable th{-webkit-box-sizing:content-box;box-sizing:content-box}table.dataTable td.dataTables_empty,table.dataTable th.dataTables_empty{text-align:center}table.dataTable.nowrap th,table.dataTable.nowrap td{white-space:nowrap}div.dataTables_wrapper div.dataTables_length label{font-weight:normal;text-align:left;white-space:nowrap}div.dataTables_wrapper div.dataTables_length select{width:75px;display:inline-block}div.dataTables_wrapper div.dataTables_filter{text-align:right}div.dataTables_wrapper div.dataTables_filter label{font-weight:normal;white-space:nowrap;text-align:left}div.dataTables_wrapper div.dataTables_filter input{margin-left:0.5em;display:inline-block;width:auto}div.dataTables_wrapper div.dataTables_info{padding-top:8px;white-space:nowrap}div.dataTables_wrapper div.dataTables_paginate{margin:0;white-space:nowrap;text-align:right}div.dataTables_wrapper div.dataTables_paginate ul.pagination{margin:2px 0;white-space:nowrap}div.dataTables_wrapper div.dataTables_processing{position:absolute;top:50%;left:50%;width:200px;margin-left:-100px;margin-top:-26px;text-align:center;padding:1em 0}table.dataTable thead>tr>th.sorting_asc,table.dataTable thead>tr>th.sorting_desc,table.dataTable thead>tr>th.sorting,table.dataTable thead>tr>td.sorting_asc,table.dataTable thead>tr>td.sorting_desc,table.dataTable thead>tr>td.sorting{padding-right:30px}table.dataTable thead>tr>th:active,table.dataTable thead>tr>td:active{outline:none}table.dataTable thead .sorting,table.dataTable thead .sorting_asc,table.dataTable thead .sorting_desc,table.dataTable thead .sorting_asc_disabled,table.dataTable thead .sorting_desc_disabled{cursor:pointer;position:relative}table.dataTable thead .sorting:after,table.dataTable thead .sorting_asc:after,table.dataTable thead .sorting_desc:after,table.dataTable thead .sorting_asc_disabled:after,table.dataTable thead .sorting_desc_disabled:after{position:absolute;bottom:8px;right:8px;display:block;font-family:'Glyphicons Halflings';opacity:0.5}table.dataTable thead .sorting:after{opacity:0.2;content:"\e150"}table.dataTable thead .sorting_asc:after{content:"\e155"}table.dataTable thead .sorting_desc:after{content:"\e156"}table.dataTable thead .sorting_asc_disabled:after,table.dataTable thead .sorting_desc_disabled:after{color:#eee}div.dataTables_scrollHead table.dataTable{margin-bottom:0 !important}div.dataTables_scrollBody>table{border-top:none;margin-top:0 !important;margin-bottom:0 !important}div.dataTables_scrollBody>table>thead .sorting:after,div.dataTables_scrollBody>table>thead .sorting_asc:after,div.dataTables_scrollBody>table>thead .sorting_desc:after{display:none}div.dataTables_scrollBody>table>tbody>tr:first-child>th,div.dataTables_scrollBody>table>tbody>tr:first-child>td{border-top:none}div.dataTables_scrollFoot>.dataTables_scrollFootInner{box-sizing:content-box}div.dataTables_scrollFoot>.dataTables_scrollFootInner>table{margin-top:0 !important;border-top:none}@media screen and (max-width: 767px){div.dataTables_wrapper div.dataTables_length,div.dataTables_wrapper div.dataTables_filter,div.dataTables_wrapper div.dataTables_info,div.dataTables_wrapper div.dataTables_paginate{text-align:center}}table.dataTable.table-condensed>thead>tr>th{padding-right:20px}table.dataTable.table-condensed .sorting:after,table.dataTable.table-condensed .sorting_asc:after,table.dataTable.table-condensed .sorting_desc:after{top:6px;right:6px}table.table-bordered.dataTable th,table.table-bordered.dataTable td{border-left-width:0}table.table-bordered.dataTable th:last-child,table.table-bordered.dataTable th:last-child,table.table-bordered.dataTable td:last-child,table.table-bordered.dataTable td:last-child{border-right-width:0}table.table-bordered.dataTable tbody th,table.table-bordered.dataTable tbody td{border-bottom-width:0}div.dataTables_scrollHead table.table-bordered{border-bottom-width:0}div.table-responsive>div.dataTables_wrapper>div.row{margin:0}div.table-responsive>div.dataTables_wrapper>div.row>div[class^="col-"]:first-child{padding-left:0}div.table-responsive>div.dataTables_wrapper>div.row>div[class^="col-"]:last-child{padding-right:0} 2 | -------------------------------------------------------------------------------- /resources/assets/dataTables-1.10.19/dataTables.bootstrap.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | DataTables Bootstrap 3 integration 3 | ©2011-2015 SpryMedia Ltd - datatables.net/license 4 | */ 5 | (function(b){"function"===typeof define&&define.amd?define(["jquery","datatables.net"],function(a){return b(a,window,document)}):"object"===typeof exports?module.exports=function(a,d){a||(a=window);if(!d||!d.fn.dataTable)d=require("datatables.net")(a,d).$;return b(d,a,a.document)}:b(jQuery,window,document)})(function(b,a,d,m){var f=b.fn.dataTable;b.extend(!0,f.defaults,{dom:"<'row'<'col-sm-6'l><'col-sm-6'f>><'row'<'col-sm-12'tr>><'row'<'col-sm-5'i><'col-sm-7'p>>",renderer:"bootstrap"});b.extend(f.ext.classes, 6 | {sWrapper:"dataTables_wrapper form-inline dt-bootstrap",sFilterInput:"form-control input-sm",sLengthSelect:"form-control input-sm",sProcessing:"dataTables_processing panel panel-default"});f.ext.renderer.pageButton.bootstrap=function(a,h,r,s,j,n){var o=new f.Api(a),t=a.oClasses,k=a.oLanguage.oPaginate,u=a.oLanguage.oAria.paginate||{},e,g,p=0,q=function(d,f){var l,h,i,c,m=function(a){a.preventDefault();!b(a.currentTarget).hasClass("disabled")&&o.page()!=a.data.action&&o.page(a.data.action).draw("page")}; 7 | l=0;for(h=f.length;l",{"class":t.sPageButton+" "+g,id:0===r&&"string"===typeof c?a.sTableId+"_"+c:null}).append(b("",{href:"#", 8 | "aria-controls":a.sTableId,"aria-label":u[c],"data-dt-idx":p,tabindex:a.iTabIndex}).html(e)).appendTo(d),a.oApi._fnBindAction(i,{action:c},m),p++)}},i;try{i=b(h).find(d.activeElement).data("dt-idx")}catch(v){}q(b(h).empty().html('