{"id":4494,"date":"2019-08-24T02:17:28","date_gmt":"2019-08-23T17:17:28","guid":{"rendered":"https:\/\/blog.capilano-fw.com\/?p=4494"},"modified":"2019-08-27T18:56:38","modified_gmt":"2019-08-27T09:56:38","slug":"laravel%e3%81%a8datatable-js%e3%82%92ajax%e3%81%a7%e9%80%a3%e6%90%ba%e3%81%95%e3%81%9b%e3%82%8b%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/blog.capilano-fw.com\/?p=4494","title":{"rendered":"Laravel\u3068DataTable.js\u3092Ajax\u3067\u9023\u643a\u3055\u305b\u308b\u65b9\u6cd5"},"content":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u6700\u8fd1\u306f\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4f7f\u3063\u305f\u69d8\u3005\u306a\u300c\u4f01\u753b\u300d\u306e\u3088\u3046\u306a\u8a18\u4e8b\u3092\u91cd\u70b9\u7684\u306b\u516c\u958b\u3057\u3066\u304d\u3066\u3044\u307e\u3057\u305f\u304c\u3001\u305f\u307e\u306b\u306f\u305d\u3046\u3044\u3063\u305f\u3082\u306e\u3068\u306f\u9055\u3063\u305f\u300c\u57fa\u672c\u7684\u306a\u30d7\u30ed\u30b0\u30e9\u30e0\u300d\u3082\u8a18\u4e8b\u306b\u3057\u305f\u3044\u306a\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u3044\u308d\u3044\u308d\u3068\u30a2\u30a4\u30c7\u30a2\u3092\u51fa\u3057\u3066\u3044\u308b\u6700\u4e2d\u3067\u3059\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001\u305d\u306e\u4e2d\u3067\u4ee5\u524d\u304b\u3089<strong>\u300c\u6c17\u306b\u306a\u3063\u3066\u3044\u305f\u3082\u306e\u306e\u5fd8\u308c\u3066\u3057\u307e\u3063\u3066\u3044\u305f\u3082\u306e\u300d<\/strong>\u306b\u6c17\u304c\u3064\u304d\u307e\u3057\u305f\u3002<\/p>\n<p>\u305d\u308c\u306f\u3001<\/p>\n<p><strong style=\"font-size: 35px;\">Laravel\u3068DataTable.js\u3092Ajax\u3092\u4f7f\u3063\u3066\u9023\u643a\u3055\u305b\u308b\u3053\u3068<\/strong><\/p>\n<p>\u3067\u3059\u3002<\/p>\n<p><a href=\"https:\/\/datatables.net\/\" target=\"_blank\" rel=\"noopener noreferrer\">DataTable.js<\/a>\u3068\u3044\u3046\u306e\u306f\u3001\u901a\u5e38\u306e\u30c6\u30fc\u30d6\u30eb\u306b\u691c\u7d22\u3084\u30bd\u30fc\u30c8\u3001\u30da\u30fc\u30b8\u30ea\u30f3\u30af\u306a\u3069\u3092\u4e00\u62ec\u3067\u63d0\u4f9b\u3057\u3066\u304f\u308c\u308b\u6709\u540d\u306a<code>jQuery<\/code>\u306e\u30d7\u30e9\u30b0\u30a4\u30f3\u306e\u3053\u3068\u3067<span style=\"font-size: 1rem;\">\u3001<code>Ajax<\/code>\u3092\u4f7f\u3046\u5834\u5408\u3001\u30c7\u30fc\u30bf\u53d6\u5f97\u306f\u4ee5\u4e0b\uff12\u3064\u306e\u30d1\u30bf\u30fc\u30f3\u304c\u3042\u308a\u307e\u3059\u3002<\/span><\/p>\n<ol>\n<li>\u6700\u521d\u306b\u5168\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3057\u3066\u304a\u3044\u3066\u3001\u3042\u3068\u306f\u5168\u3066 &#8220;DataTable&#8221; \u306b\u307e\u304b\u305b\u308b<\/li>\n<li>\u30da\u30fc\u30b8\u304c\u5207\u308a\u66ff\u308f\u308b\u3054\u3068\u306b\u30b5\u30fc\u30d0\u30fc\u30b5\u30a4\u30c9\uff08PHP\u306a\u3069\uff09\u304b\u3089\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3059\u308b<\/li>\n<\/ol>\n<p>\u3082\u3061\u308d\u3093\u30c7\u30fc\u30bf\u304c\u5c11\u306a\u3051\u308c\u3070\uff11\u756a\u306e\u30b7\u30f3\u30d7\u30eb\u306a\u65b9\u6cd5\u3067\u554f\u984c\u306f\u306a\u3044\u306e\u3067\u3059\u304c\u3001\u3053\u308c\u304c\u4f55\u5343\u3001\u4f55\u4e07\u4ef6\u3068\u306a\u3063\u3066\u304f\u308b\u3068\u30da\u30fc\u30b8\u8868\u793a\u304c\u76ee\u306b\u898b\u3048\u3066\u9045\u304f\u306a\u3063\u305f\u308a\u3082\u3057\u307e\u3059\ud83d\ude2b<\/p>\n<p>\u305d\u3053\u3067\u767b\u5834\u3059\u308b\u306e\u304c\uff12\u756a\u306a\u306e\u3067\u3059\u304c\u3001\u3053\u306e\u5834\u5408\u3060\u3068\u691c\u7d22\u3084\u30bd\u30fc\u30c8\u306a\u3069\u306f\u81ea\u524d\u3067\u5b9f\u88c5\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u305d\u3053\u3067\uff01<\/p>\n<p>\u4eca\u56de\u306f\u3001\u3053\u306e\u300c\u3061\u3087\u3063\u3068\u8907\u96d1\u3060\u3051\u3069\u5feb\u9069\u300d\u306a\uff12\u756a\u3081\u306e\u65b9\u6cd5\u3067<code>Laravel<\/code>\u3068<code>DataTable<\/code>\u3092\u9023\u643a\u3055\u305b\u308b\u65b9\u6cd5\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<p>\u305c\u3072\u3001\u7686\u3055\u3093\u306e\u304a\u5f79\u306b\u7acb\u3066\u308b\u3068\u5b09\u3057\u3044\u3067\u3059\ud83d\ude0a\u2728<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4445 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/no_2.png\" alt=\"\" width=\"370\" height=\"310\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/no_2.png 370w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/no_2-300x251.png 300w\" sizes=\"auto, (max-width: 370px) 100vw, 370px\" \/><\/p>\n<p><strong>\u958b\u767a\u74b0\u5883\uff1a<\/strong> Laravel 5.8\u3001jQuery 3.4\u3001DataTable 1.10<\/p>\n<h1>\u30eb\u30fc\u30c8\u3092\u3064\u304f\u308b<\/h1>\n<p>\u307e\u305a\u306f\u3058\u3081\u306b\u3001\u30d6\u30e9\u30a6\u30b6\u304b\u3089\u30a2\u30af\u30bb\u30b9\u3059\u308b\u305f\u3081\u306e\u30eb\u30fc\u30c8\u3092\u4f5c\u308a\u307e\u3059\u3002<code>routes\/web.php<\/code>\u306b\u4ee5\u4e0b\u3092\u8ffd\u52a0\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre><strong>Route::get('datatable', 'DataTableController@index');<\/strong>\r\n<strong>Route::get('datatable\/ajax', 'DataTableController@ajax');<\/strong><\/pre>\n<p>\u4e0a\u306e\u30eb\u30fc\u30c8\u304c\u5b9f\u969b\u306b\u76ee\u306b\u3059\u308b\u30da\u30fc\u30b8\u3067\u3001\u4e0b\u306e\u3082\u306e\u306fAjax\u3067\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3059\u308b\u3082\u306e\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h1>\u30e2\u30c7\u30eb\u3001\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u3001\u30c6\u30b9\u30c8\u30c7\u30fc\u30bf\u3092\u3064\u304f\u308b<\/h1>\n<p>\u3067\u306f\u3001<code>DataTable<\/code>\u3067\u8868\u793a\u3059\u308b\u305f\u3081\u306e\u30c7\u30fc\u30bf\u3092\u7528\u610f\u3059\u308b\u305f\u3081\u306b\u30e2\u30c7\u30eb\u3001\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u3001\u30c6\u30b9\u30c8\u30c7\u30fc\u30bf\u304c\u5fc5\u8981\u306b\u306a\u308a\u307e\u3059\u304c\u3001\u3053\u3061\u3089\u306f\u4ee5\u524d\u6295\u7a3f\u3057\u305f\u8a18\u4e8b\u306e\u5185\u5bb9\u3068\u540c\u3058\u3067\u3059\u306e\u3067\u305d\u3061\u3089\u3092\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<ul>\n<li><a href=\"https:\/\/blog.capilano-fw.com\/?p=4385#i-5\" target=\"_blank\" rel=\"noopener noreferrer\">\u30e2\u30c7\u30eb\u3068\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u3064\u304f\u308b<\/a><\/li>\n<li><a href=\"https:\/\/blog.capilano-fw.com\/?p=4385#Seeder\" target=\"_blank\" rel=\"noopener noreferrer\">Seeder\u3067\u30c6\u30b9\u30c8\u30c7\u30fc\u30bf\u3092\u3064\u304f\u308b<\/a><\/li>\n<\/ul>\n<h1>\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3092\u3064\u304f\u308b<\/h1>\n<p>\u307e\u305f\u3001\u5148\u307b\u3069\u30eb\u30fc\u30c8\u3067\u6307\u5b9a\u3057\u305f\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u306f\u5b58\u5728\u3057\u3066\u3044\u306a\u3044\u306e\u3067\u3001\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3067\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<pre><strong>php artisan make:controller DataTableController<\/strong><\/pre>\n<p>\u3059\u308b\u3068\u3001<code>app\/Http\/Controllers\/DataTableController.php<\/code>\u304c\u4f5c\u6210\u3055\u308c\u308b\u306e\u3067\u4e2d\u8eab\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<pre>&lt;?php\r\n\r\nnamespace App\\Http\\Controllers;\r\n\r\nuse Illuminate\\Http\\Request;\r\n\r\nclass DataTableController extends Controller\r\n{\r\n    <strong>public function index() {<\/strong>\r\n\r\n<strong>        return view('datatable');<\/strong>\r\n\r\n<strong>    }<\/strong>\r\n\r\n    <strong>public function ajax(Request $request) {<\/strong>\r\n\r\n<strong>        $query = \\App\\Product::query();<\/strong>\r\n\r\n<strong>        \/\/ \u691c\u7d22<\/strong>\r\n<strong>        if($request-&gt;filled('search.value')) {<\/strong>\r\n\r\n<strong>            $search_value = trim(<\/strong>\r\n<strong>                mb_convert_kana($request-&gt;input('search.value'), 's')<\/strong>\r\n<strong>            );<\/strong>\r\n<strong>            $keywords = explode(' ', $search_value);<\/strong>\r\n\r\n<strong>            foreach($keywords as $keyword) {<\/strong>\r\n\r\n<strong>                $query-&gt;where('name', 'LIKE', '%'. $keyword .'%');<\/strong>\r\n\r\n<strong>            }<\/strong>\r\n\r\n<strong>        }<\/strong>\r\n\r\n<strong>        \/\/ \u30bd\u30fc\u30c8<\/strong>\r\n<strong>        if($request-&gt;filled('order.0.column')) {<\/strong>\r\n\r\n<strong>            $order_column_index = $request-&gt;input('order.0.column');<\/strong>\r\n<strong>            $order_column = $request-&gt;input('columns.'. $order_column_index .'.data');<\/strong>\r\n<strong>            $order_direction = $request-&gt;input('order.0.dir');<\/strong>\r\n<strong>            $query-&gt;orderBy($order_column, $order_direction);<\/strong>\r\n\r\n<strong>        }<\/strong>\r\n\r\n<strong>        $start = intval($request-&gt;start);<\/strong>\r\n<strong>        $per_page = intval($request-&gt;length);<\/strong>\r\n<strong>        $columns = [<\/strong>\r\n<strong>            'code',<\/strong>\r\n<strong>            'name',<\/strong>\r\n<strong>            'created_at'<\/strong>\r\n<strong>        ];<\/strong>\r\n<strong>        $current_page = ($per_page === 0) ? 1 : $start \/ $per_page + 1;<\/strong>\r\n<strong>        return $query-&gt;paginate($per_page, $columns, '', $current_page);<\/strong>\r\n\r\n<strong>    }<\/strong>\r\n}<\/pre>\n<p>\u3010\u8ffd\u8a18\uff1a2019.8.27\u3011<code>mb_convert_kana()<\/code>\u306e\u5f15\u6570\u304c\u8db3\u308a\u306a\u304b\u3063\u305f\u306e\u3067\u8ffd\u52a0\u3057\u307e\u3057\u305f\u3002\u3059\u307f\u307e\u305b\u3093\ud83d\ude2b<\/p>\n<p>\u3053\u3053\u3067\u91cd\u8981\u306a\u306e\u304c\u3001<code>ajax()<\/code>\u3067\u3059\u3002<\/p>\n<p>\u3053\u306e\u30e1\u30bd\u30c3\u30c9\u306fAjax\u3092\u901a\u3057\u3066<code>DataTable<\/code>\u306e\u30c7\u30fc\u30bf\u3092\u7528\u610f\u3059\u308b\u3082\u306e\u3067\u3059\u304c\u3001\u8a18\u4e8b\u306e\u5192\u982d\u3067\u3082\u66f8\u3044\u305f\u3068\u304a\u308a\u3001\u300c\u691c\u7d22\u300d\u3084\u300c\u30bd\u30fc\u30c8\u300d\u306f\u81ea\u524d\u3067\u5b9f\u88c5\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u305d\u306e\u305f\u3081\u3001\u3069\u3061\u3089\u3082<code>DataTable<\/code>\u304c\u9001\u4fe1\u3057\u3066\u304f\u308b\u3042\u308b\u30c7\u30fc\u30bf\u304c\u5b58\u5728\u3057\u3066\u3044\u308c\u3070\u3001\u691c\u7d22\u3001\u3082\u3057\u304f\u306f\u30bd\u30fc\u30c8\u3092\u5b9f\u884c\u3059\u308b\u30b3\u30fc\u30c9\u3092\u7528\u610f\u3057\u3066\u3044\u307e\u3059\u3002\uff08\u691c\u7d22\u306fAnd\u691c\u7d22\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u306e\u3067\u3001\u304a\u597d\u307f\u3067\u6539\u5909\u3057\u3066\u304f\u3060\u3055\u3044\uff09<\/p>\n<p>\u307e\u305f\u3001<code>DataTable<\/code>\u306f<strong>\u30d1\u30e9\u30e1\u30fc\u30bf\u3068\u3057\u3066\u73fe\u5728\u306e\u30da\u30fc\u30b8\u756a\u53f7\u3092\u9001\u4fe1\u3057\u3066\u304f\u308c\u307e\u305b\u3093<\/strong>\u306e\u3067\u3001\u3053\u3061\u3089\u3082<code>start<\/code>\u3068<code>length<\/code>\u3092\u4f7f\u3063\u3066\u81ea\u524d\u3067\u8a08\u7b97\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u306a\u304a\u3001\u3053\u306e\u30b3\u30fc\u30c9\u306e\u4e2d\u3067\u306f\u3001\u30d1\u30e9\u30e1\u30fc\u30bf\u540d\u306e\u5909\u66f4\u3092\u3057\u3066\u306a\u3044\u3053\u3068\u306b\u6ce8\u76ee\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u672c\u6765\u306f<code>DataTable<\/code>\u304c\u6307\u5b9a\u3059\u308b\u30d1\u30e9\u30e1\u30fc\u30bf\u3067\u30c7\u30fc\u30bf\u3092\u7528\u610f\u3059\u3079\u304d\u3067\u3059\u304c\u3001\u4eca\u56de\u306f<code>DataTable<\/code>\u5074\u3067\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u52a0\u5de5\u3057\u3066\u5b9f\u88c5\u3057\u307e\u3059\u3002<\/p>\n<h1>\u30d3\u30e5\u30fc\u3092\u3064\u304f\u308b<\/h1>\n<p>\u3067\u306f\u3001\u6700\u5f8c\u306b\u30d3\u30e5\u30fc\u3092\u3064\u304f\u308a\u307e\u3059\u3002<br \/>\n<code>resources\/views\/datatable.blade.php<\/code>\u306b\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u3066\u3001\u4e2d\u8eab\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u203b jQuery\u3001DataTable\u306fCDN\u3092\u4f7f\u3063\u3066\u547c\u3073\u51fa\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre>&lt;html&gt;\r\n&lt;head&gt;\r\n    <strong>&lt;link href=\"https:\/\/cdn.datatables.net\/1.10.19\/css\/jquery.dataTables.min.css\" rel=\"stylesheet\"&gt;<\/strong>\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n    <strong>&lt;table id=\"table\"&gt;&lt;\/table&gt;<\/strong>\r\n    <strong>&lt;script src=\"https:\/\/code.jquery.com\/jquery-3.4.1.min.js\"&gt;&lt;\/script&gt;<\/strong>\r\n<strong>    &lt;script src=\"https:\/\/cdn.datatables.net\/1.10.19\/js\/jquery.dataTables.min.js\"&gt;&lt;\/script&gt;<\/strong>\r\n    &lt;script&gt;\r\n\r\n        $(() =&gt; {\r\n\r\n            $('#table').DataTable({\r\n                <strong>searching: true,<\/strong>    \/\/ \u691c\u7d22\u3059\u308b\uff1f\uff1f\r\n                <strong>ordering: true,<\/strong>     \/\/ \u4e26\u3079\u66ff\u3048\u3059\u308b\uff1f\uff1f\r\n                <strong>lengthChange: true,<\/strong> \/\/ \u30da\u30fc\u30b8\u3054\u3068\u306b\u4f55\u4ef6\u8868\u793a\u3059\u308b\uff1f\uff1f\r\n                <strong>serverSide: true,<\/strong>   \/\/ \u30b5\u30fc\u30d0\u30fc\u30b5\u30a4\u30c9\u3092\u4f7f\u3046\uff1f\uff1f\r\n                <strong>ajax: {<\/strong>\r\n<strong>                    url: '\/datatable\/ajax', \/\/ \u30c7\u30fc\u30bf\u53d6\u5f97\u3059\u308bURL<\/strong>\r\n<strong>                    dataFilter(data) {      \/\/ \u53d6\u5f97\u3057\u305f\u30c7\u30fc\u30bf\u3092\u52a0\u5de5\u3059\u308b<\/strong>\r\n\r\n<strong>                        let json = JSON.parse(data);<\/strong>\r\n<strong>                        json.recordsTotal = json.total;<\/strong>\r\n<strong>                        json.recordsFiltered = json.total;<\/strong>\r\n<strong>                        return JSON.stringify(json);<\/strong>\r\n\r\n<strong>                    }<\/strong>\r\n<strong>                }<\/strong>,\r\n                <strong>columns: [<\/strong>\r\n<strong>                    {<\/strong>\r\n<strong>                        data: 'code',<\/strong>\r\n<strong>                        title: '\u5546\u54c1\u30b3\u30fc\u30c9'<\/strong>\r\n<strong>                    },<\/strong>\r\n<strong>                    {<\/strong>\r\n<strong>                        data: 'name',<\/strong>\r\n<strong>                        title: '\u540d\u524d'<\/strong>\r\n<strong>                    },<\/strong>\r\n<strong>                    {<\/strong>\r\n<strong>                        data: 'created_at',<\/strong>\r\n<strong>                        title: '\u767b\u9332\u65e5\u6642',<\/strong>\r\n<strong>                        orderable: false<\/strong>    \/\/ \u3053\u3053\u306e\u9805\u76ee\u306f\u4e26\u3079\u66ff\u3048\u3057\u306a\u3044\r\n<strong>                    }<\/strong>\r\n<strong>                ]<\/strong>,\r\n                <strong>order: [[ 0, 'asc' ]],<\/strong>   \/\/ \u4e26\u3079\u66ff\u3048\u9805\u76ee\u3092\u6307\u5b9a,\r\n                <strong>language: { \/\/ \u65e5\u672c\u8a9e\u5bfe\u5fdc<\/strong>\r\n<strong>                    url: 'https:\/\/cdn.datatables.net\/plug-ins\/1.10.19\/i18n\/Japanese.json'<\/strong>\r\n<strong>                }<\/strong>\r\n            });\r\n\r\n        });\r\n\r\n    &lt;\/script&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;<\/pre>\n<p>\u307e\u305a\u3001<code>DataTable<\/code>\u306e\u57fa\u672c\u7684\u306a\u4f7f\u3044\u65b9\u306f\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b<code>&lt;table&gt;&lt;\/table&gt;<\/code>\u30bf\u30b0\u3092\u4f5c\u3063\u3066<code>jQuery<\/code>\u30bb\u30ec\u30af\u30bf\u3067\u5c02\u7528\u30e1\u30bd\u30c3\u30c9\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n<pre>&lt;!-- HTML --&gt;\r\n<strong>&lt;table id=\"table\"&gt;&lt;\/table&gt;<\/strong><\/pre>\n<pre>\/\/ JavaScript\r\n<strong>$('#table').DataTable();<\/strong><\/pre>\n<p>\u305d\u3057\u3066\u3001\u305d\u306e\u30e1\u30bd\u30c3\u30c9\u306b\u306f\u5404\u7a2e\u30aa\u30d7\u30b7\u30e7\u30f3\u5024\u3092\u6307\u5b9a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<br \/>\n\u4eca\u56de\u306e\u4f8b\u3067\u306f\u4f55\u3092\u6307\u5b9a\u3057\u305f\u306e\u304b\u3092\u898b\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<h2>searching<\/h2>\n<p>\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u691c\u7d22\u30dc\u30c3\u30af\u30b9\u3092\u8868\u793a\u3059\u308b\u304b\u3069\u3046\u304b\u3092\u6c7a\u3081\u308b\u30aa\u30d7\u30b7\u30e7\u30f3\u3067\u3059\u3002<br \/>\n<code>true<\/code> or <code>false<\/code>\u3067\u6307\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4495\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/laravel_datatable_1.png\" alt=\"\" width=\"249\" height=\"46\" \/><\/p>\n<h2>ordering<\/h2>\n<p>\u30bd\u30fc\u30c8\uff08\u4e26\u3079\u66ff\u3048\uff09\u3092\u3059\u308b\u304b\u3069\u3046\u304b\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u3002<br \/>\n<code>true<\/code> or <code>false<\/code>\u3067\u6307\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<p>\u6709\u52b9\u306b\u3059\u308b\u3068\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u30c6\u30fc\u30d6\u30eb\u30d8\u30c3\u30c0\u30fc\u306b\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u4e09\u89d2\u30de\u30fc\u30af\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4496\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/laravel_datatable_2.png\" alt=\"\" width=\"376\" height=\"52\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/laravel_datatable_2.png 376w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/laravel_datatable_2-300x41.png 300w\" sizes=\"auto, (max-width: 376px) 100vw, 376px\" \/><\/p>\n<h2>lengthChange<\/h2>\n<p>\u30da\u30fc\u30b8\u3054\u3068\u306b\u4f55\u4ef6\u8868\u793a\u3059\u308b\u304b\u3092\u6307\u5b9a\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b\u30aa\u30d7\u30b7\u30e7\u30f3\u3002<br \/>\n<code>true<\/code> or <code>false<\/code>\u3067\u6307\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<p>\u6709\u52b9\u306b\u3059\u308b\u3068\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30bb\u30ec\u30af\u30c8\u30dc\u30c3\u30af\u30b9\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4497\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/laravel_datatable_3.png\" alt=\"\" width=\"120\" height=\"45\" \/><\/p>\n<h2>serverSide<\/h2>\n<p>\u3053\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u304c\u4eca\u56de\u5fc5\u305a\u6307\u5b9a\u3057\u306a\u3044\u3068\u3044\u3051\u306a\u3044\u30aa\u30d7\u30b7\u30e7\u30f3\u3067\u3001\u3053\u308c\u3092<code>true<\/code>\u306b\u3059\u308b\u3053\u3068\u3067\u3001<strong>\u300c\u30da\u30fc\u30b8\u3054\u3068\u306b\u30c7\u30fc\u30bf\u3092\u7528\u610f\u3059\u308b\u300d<\/strong>\u8a2d\u5b9a\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h2>ajax<\/h2>\n<p>\u30c7\u30fc\u30bf\u53d6\u5f97\u3059\u308bAjax\u306e\u8a2d\u5b9a\u3092\u3059\u308b\u30aa\u30d7\u30b7\u30e7\u30f3\u3067\u3059\u3002<\/p>\n<p>\u4eca\u56de\u306f\u3001<code>Ajax<\/code>\u3067\u30a2\u30af\u30bb\u30b9\u3059\u308b<code>URL<\/code>\u3068\u3001\u53d6\u5f97\u3057\u3066\u30c7\u30fc\u30bf\u3092\u52a0\u5de5\u3059\u308b<code>dataFilter()<\/code>\u3092\u7528\u610f\u3057\u3066\u3044\u307e\u3059\u3002<code>Laravel<\/code>\u5074\u3067\u7279\u306b\u30d1\u30e9\u30e1\u30fc\u30bf\u540d\u306e\u5909\u66f4\u3092\u3057\u306a\u304b\u3063\u305f\u306e\u306f\u3001<code>dataFilter()<\/code>\u3092\u6e96\u5099\u3059\u308b\u3064\u3082\u308a\u3060\u3063\u305f\u304b\u3089\u3067\u3059\u3002<\/p>\n<h2>columns<\/h2>\n<p>\u30ab\u30e9\u30e0\uff08\u30c6\u30fc\u30d6\u30eb\u306e\u9805\u76ee\uff09\u3092\u6307\u5b9a\u3059\u308b\u30aa\u30d7\u30b7\u30e7\u30f3\u3067\u3059\u3002<br \/>\n\u4e2d\u8eab\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<ul>\n<li>data\u3000\u30fb\u30fb\u30fb\u3000\u30c7\u30fc\u30bf\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u30fb\u30ad\u30fc\uff08\u3064\u307e\u308a\u4eca\u56de\u306e\u5834\u5408\u3060\u3068<code>products<\/code>\u30c6\u30fc\u30d6\u30eb\u306e\u30ab\u30e9\u30e0\u540d\uff09<\/li>\n<li>title\u3000\u30fb\u30fb\u30fb\u3000\u30c6\u30fc\u30d6\u30eb\u30d8\u30c3\u30c0\u30fc\u306b\u8868\u793a\u3055\u308c\u308b\u9805\u76ee\u540d<\/li>\n<\/ul>\n<h2>language<\/h2>\n<p><code>DataTable<\/code>\u3092\u591a\u8a00\u8a9e\u5316\u3059\u308b\u30aa\u30d7\u30b7\u30e7\u30f3\u3002<br \/>\nURL\u3092\u6307\u5b9a\u3059\u308b\u3053\u3068\u3067<code>CDN<\/code>\u3092\u4f7f\u3063\u3066\u65e5\u672c\u8a9e\u5316\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002<\/p>\n<h1>\u30c6\u30b9\u30c8\u3057\u3066\u307f\u308b<\/h1>\n<p>\u3067\u306f\u3001\u5b9f\u969b\u306b\u30c6\u30b9\u30c8\u3057\u3066\u307f\u307e\u3057\u3087\u3046\uff01<br \/>\n\u307e\u305a\u306f\u9759\u6b62\u753b\u304b\u3089\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4498\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/laravel_datatable_4.png\" alt=\"\" width=\"1021\" height=\"537\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/laravel_datatable_4.png 1021w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/laravel_datatable_4-300x158.png 300w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/laravel_datatable_4-768x404.png 768w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/p>\n<p>\u306f\u3044\uff01<br \/>\n\u3046\u307e\u304f\u8868\u793a\u3055\u308c\u307e\u3057\u305f\u3002<\/p>\n<p>\u3067\u306f\u52d5\u753b\u306e\u65b9\u3067\u3082\u898b\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><iframe loading=\"lazy\" title=\"Laravel\u3068DataTable.js\u3092Ajax\u3067\u9023\u643a\u3055\u305b\u305f\u30b5\u30f3\u30d7\u30eb\" width=\"525\" height=\"295\" src=\"https:\/\/www.youtube.com\/embed\/Z3fAvsMF5-k?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p>\n<p>\u306f\u3044\uff01<br \/>\n\u3053\u3061\u3089\u3082\u3046\u307e\u304f\u3044\u304d\u307e\u3057\u305f\u3002<\/p>\n<p>\u304a\u75b2\u308c\u69d8\u3067\u3057\u305f\ud83d\ude0a\u2728<\/p>\n<h1>\u304a\u308f\u308a\u306b<\/h1>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u4eca\u56de\u306f<code>Laravel<\/code>\u3068<code>DataTable<\/code>\u3092<code>Ajax<\/code>\u3067\u9023\u643a\u3055\u305b\u308b\u30b5\u30f3\u30d7\u30eb\u3092\u7d39\u4ecb\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u6700\u8fd1\u306e<code>JavaScript<\/code>\u696d\u754c\u3067\u306f\u3001\u7279\u306b<code>Angular<\/code>\u3084<code>React<\/code>\u304c\u767b\u5834\u3057\u305f\u3042\u305f\u308a\u304b\u3089<code>jQuery<\/code>\u306f\u5f90\u3005\u306b\u4f7f\u308f\u308c\u306a\u304f\u306a\u3063\u3066\u304d\u3066\u3044\u308b\u3088\u3046\u3067\u3059\u304c\u3001\u305d\u308c\u3067\u3082\u3084\u306f\u308a<code>jQuery<\/code>\u306f\u4fbf\u5229\u3067\u3059\u3057\u3001\u4f55\u3088\u308a\u4eca\u56de\u306e<code>DataTable<\/code>\u306e\u3088\u3046\u306a\u6709\u80fd\u306a\u30d7\u30e9\u30b0\u30a4\u30f3\u304c\u30a4\u30f3\u30bf\u30fc\u30cd\u30c3\u30c8\u306b\u306f\u3044\u304f\u3064\u3082\u8ee2\u304c\u3063\u3066\u3044\u308b\u3053\u3068\u3092\u8003\u3048\u308b\u3068\u3001\u5229\u7528\u3059\u308b\u9078\u629e\u80a2\u3068\u3057\u3066\u306f\u512a\u5148\u7684\u306b\u8003\u3048\u3066\u3044\u3044\u306e\u3067\u306f\u306a\u3044\u3067\u3057\u3087\u3046\u304b\u3002<\/p>\n<p>\u7279\u306b<code>Bootstrap<\/code>\u3092<code>CSS<\/code>\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3068\u3057\u3066\u5229\u7528\u3059\u308b\u5834\u5408\u306f<code>jQuery<\/code>\u304c\u5fc5\u8981\u306a\u6a5f\u80fd\u3082\u591a\u3044\u3067\u3059\u3057\u3001\u306a\u306b\u3088\u308a\u305f\u3063\u305f\u4e00\u6587\u5b57<code>$<\/code>\u3068\u66f8\u304f\u3060\u3051\u3067\u8981\u7d20\u306b\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b\u3063\u3066\u306e\u306f\u3001\u3084\u306f\u308a\u3059\u3070\u3089\u3057\u3044\u767a\u660e\u3060\u3068\u601d\u3044\u307e\u3059\u3002\uff08\u305f\u3057\u304b\u3001\u3082\u3068\u3082\u3068\u306f<code>prototype.js<\/code>\u3068\u304b\u3060\u3063\u305f\u6c17\u304c\u3057\u307e\u3059\ud83d\ude05\uff09<\/p>\n<p>\u3068\u306b\u304b\u304f\u3001<code>DataTable<\/code>\u3063\u3066\u3068\u3066\u3082\u4fbf\u5229\u3067\u3059\u3002<br \/>\n<span style=\"font-size: 1rem;\">\u305c\u3072\u7686\u3055\u3093\u3082\u6311\u6226\u3057\u3066\u307f\u3066<\/span><span style=\"font-size: 1rem;\">\u304f\u3060\u3055\u3044\u306d\u3002<\/span><\/p>\n<p>\u3067\u306f\u3067\u306f\u301c\u266a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3467 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_9.png\" alt=\"\" width=\"216\" height=\"320\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_9.png 216w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_9-203x300.png 203w\" sizes=\"auto, (max-width: 216px) 100vw, 216px\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u6700\u8fd1\u306f\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4f7f\u3063\u305f\u69d8\u3005\u306a\u300c\u4f01\u753b\u300d\u306e\u3088\u3046\u306a\u8a18\u4e8b\u3092\u91cd\u70b9\u7684\u306b\u516c\u958b\u3057\u3066\u304d\u3066\u3044\u307e\u3057\u305f\u304c\u3001\u305f\u307e\u306b\u306f\u305d\u3046\u3044\u3063\u305f\u3082\u306e\u3068\u306f\u9055\u3063\u305f\u300c\u57fa\u672c\u7684\u306a\u30d7\u30ed\u30b0\u30e9\u30e0\u300d\u3082\u8a18\u4e8b\u306b\u3057\u305f &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blog.capilano-fw.com\/?p=4494\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;Laravel\u3068DataTable.js\u3092Ajax\u3067\u9023\u643a\u3055\u305b\u308b\u65b9\u6cd5&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":4501,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[129,3],"tags":[170],"class_list":["post-4494","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-jquery","category-laravel","tag-datatable"],"_links":{"self":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/4494","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4494"}],"version-history":[{"count":5,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/4494\/revisions"}],"predecessor-version":[{"id":4504,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/4494\/revisions\/4504"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/media\/4501"}],"wp:attachment":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4494"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4494"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4494"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}