{"action":"closed","issue":{"url":"https://api.github.com/repos/yajra/laravel-datatables/issues/1834","repository_url":"https://api.github.com/repos/yajra/laravel-datatables","labels_url":"https://api.github.com/repos/yajra/laravel-datatables/issues/1834/labels{/name}","comments_url":"https://api.github.com/repos/yajra/laravel-datatables/issues/1834/comments","events_url":"https://api.github.com/repos/yajra/laravel-datatables/issues/1834/events","html_url":"https://github.com/yajra/laravel-datatables/issues/1834","id":358373164,"node_id":"MDU6SXNzdWUzNTgzNzMxNjQ=","number":1834,"title":"Responsive tables support","user":{"login":"Fieel","id":11167635,"node_id":"MDQ6VXNlcjExMTY3NjM1","avatar_url":"https://avatars2.githubusercontent.com/u/11167635?v=4","gravatar_id":"","url":"https://api.github.com/users/Fieel","html_url":"https://github.com/Fieel","followers_url":"https://api.github.com/users/Fieel/followers","following_url":"https://api.github.com/users/Fieel/following{/other_user}","gists_url":"https://api.github.com/users/Fieel/gists{/gist_id}","starred_url":"https://api.github.com/users/Fieel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Fieel/subscriptions","organizations_url":"https://api.github.com/users/Fieel/orgs","repos_url":"https://api.github.com/users/Fieel/repos","events_url":"https://api.github.com/users/Fieel/events{/privacy}","received_events_url":"https://api.github.com/users/Fieel/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-09-09T12:04:01Z","updated_at":"2018-09-09T12:35:16Z","closed_at":"2018-09-09T12:35:16Z","author_association":"NONE","body":"### Summary of problem or feature request\r\n\r\nI'd love to use the responsive features of Datatables in my Laravel projects. Tried both the [Configuration option and HTML data-priority attribute with no lucl](https://datatables.net/extensions/responsive/priority) with no luck. [It's well documented, not sure what i'm missing.](https://datatables.net/reference/option/columns.responsivePriority). Also i added the needed [extensionsCDN, right?](https://datatables.net/download/release) Couldn't find anything about responsive behaviour from yajra laravel-datatables wiki.\r\n\r\nThere seem to be two kind of docs/wikis? It gets confusing pretty quick\r\nhttps://yajrabox.com/docs/laravel-datatables/\r\nhttps://datatables.yajrabox.com/\r\n\r\nAnyways, i have a controller which returns the data from the db as JSON format, then a js script that creates the **table with id datatable-mandati-aperti**.\r\n\r\nAs you can see, i also added the files i imported (css files in the head section of the html), i also imported the scripts prior to the js script.\r\n\r\n### Code snippet of problem\r\n\r\nHTML (importing both datatables.css and responsive.datatables.css:\r\n```html\r\n<head>\r\n    <!-- datatables  -->\r\n    <link rel=\"stylesheet\" href=\"https://cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css\" type=\"text/css\">\r\n    <link rel=\"stylesheet\" href=\"https://cdn.datatables.net/responsive/2.2.3/css/responsive.dataTables.min.css\" type=\"text/css\">\r\n</head>\r\n<body>\r\n    <table id=\"datatable-mandati-aperti\" class=\"table table-condensed table-striped\" style=\"width:100%\">\r\n        <thead>\r\n        <tr>\r\n            <th>Id</th>\r\n            <th>Responsabile</th>\r\n            <th>Descrizione</th>\r\n            <th>Cliente</th>\r\n            <th>Data apertura</th>\r\n            <th></th>\r\n        </tr>\r\n        </thead>\r\n    </table>\r\n</body>\r\n```\r\n\r\nJS script:\r\n```javascript\r\n        $(function() {\r\n            $('#datatable-mandati-aperti').DataTable({\r\n                responsive: true,\r\n                columnDefs: [\r\n                    { responsivePriority: 1, targets: 0 },\r\n                    { responsivePriority: 2, targets: -1 }\r\n                ],\r\n                processing: true,\r\n                serverSide: true,\r\n                ajax: 'http://gestione.dossi.test/datatables/mandati-aperti',\r\n                \"columns\": [\r\n                    { data: 'id'},\r\n                    { data: 'responsabile'},\r\n                    { data: 'descrizione'},\r\n                    { data: 'cliente_id'},\r\n                    { data: 'data_apertura'},\r\n                    { data: 'action', orderable: false, searchable: false}\r\n                ],\r\n                \"order\": [[ 0, \"desc\" ]]\r\n            });\r\n        });\r\n```\r\n\r\nPHP controller:\r\n\r\n```php\r\npublic function get_datatable_mandati_aperti() {\r\n    return datatables()->of( Mandato::query()->whereNull('data_chiusura'))\r\n         ->editColumn( 'data_apertura', function ( $mandato ) { \r\n\t        return $mandato->data_apertura->format( 'd.m.Y' );\r\n\t} )\r\n\t->editColumn( 'cliente_id', function ( $mandato ) {\r\n\t\treturn '<a href=\"'  .  route('clienti.edit', $mandato->cliente->id )  .  '\">'  .  $mandato->cliente->direttore  .  '</a>';\r\n\t} )\r\n\t->addColumn( 'action', function ( $mandato ) {\r\n\t\treturn '<a style=\"margin=2px;\" href=\"' . route( 'mandati.edit', $mandato->id ) . '\" class=\"btn btn-xs btn-primary\"><i class=\"glyphicon glyphicon-edit\"></i> Modifica</a>';\r\n\t } )\r\n\t->rawColumns(['cliente_id', 'action']) // permette di iniettarci html\r\n\t->toJson();\r\n\t}\r\n```\r\n\r\n### System details\r\n\r\n<!--\r\nPlease include these details about your system!\r\nIf they are omitted, the ticket will be deprioritized\r\nover other users requests/tickets.\r\n-->\r\n\r\n- Operating System\r\n\r\nI'm running the standard vagrant+homestead configuration [as seen here](https://laravel.com/docs/5.6/homestead).\r\n\r\n- PHP Version\r\n\r\n```bash\r\nPHP 7.2.5-1+ubuntu18.04.1+deb.sury.org+1 (cli) (built: May  5 2018 05:00:15) ( NTS )\r\nCopyright (c) 1997-2018 The PHP Group\r\nZend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies\r\n    with Zend OPcache v7.2.5-1+ubuntu18.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies\r\n    with blackfire v1.20.0~linux-x64-non_zts72, https://blackfire.io, by Blackfire\r\n```\r\n\r\n- Laravel Version\r\n\r\n5.6\r\n\r\n- Laravel-Datatables Version\r\n\r\n\"yajra/laravel-datatables-oracle\": \"~8.0\"\r\n\r\n"}}
{"actor":{"display_login":"Fieel"}}