{"action":"created","issue":{"url":"https://api.github.com/repos/yajra/laravel-datatables/issues/1736","repository_url":"https://api.github.com/repos/yajra/laravel-datatables","labels_url":"https://api.github.com/repos/yajra/laravel-datatables/issues/1736/labels{/name}","comments_url":"https://api.github.com/repos/yajra/laravel-datatables/issues/1736/comments","events_url":"https://api.github.com/repos/yajra/laravel-datatables/issues/1736/events","html_url":"https://github.com/yajra/laravel-datatables/issues/1736","id":322234656,"number":1736,"title":"I use all in one installer package yajra/laravel-datatables:^1.0 but buttons are not created","user":{"login":"krajdyal","id":3018383,"avatar_url":"https://avatars0.githubusercontent.com/u/3018383?v=4","gravatar_id":"","url":"https://api.github.com/users/krajdyal","html_url":"https://github.com/krajdyal","followers_url":"https://api.github.com/users/krajdyal/followers","following_url":"https://api.github.com/users/krajdyal/following{/other_user}","gists_url":"https://api.github.com/users/krajdyal/gists{/gist_id}","starred_url":"https://api.github.com/users/krajdyal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/krajdyal/subscriptions","organizations_url":"https://api.github.com/users/krajdyal/orgs","repos_url":"https://api.github.com/users/krajdyal/repos","events_url":"https://api.github.com/users/krajdyal/events{/privacy}","received_events_url":"https://api.github.com/users/krajdyal/received_events","type":"User","site_admin":false},"labels":[{"id":67904193,"url":"https://api.github.com/repos/yajra/laravel-datatables/labels/question","name":"question","color":"cc317c","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-05-11T09:44:11Z","updated_at":"2018-05-12T06:28:23Z","closed_at":null,"author_association":"NONE","body":"I use all in one installer package yajra/laravel-datatables:^1.0 datatable works fine but buttons are not created.\r\n\r\nResulting Javascript also seems fine.\r\n\r\n```\r\n(function(window,$){window.LaravelDataTables=window.LaravelDataTables||{};window.LaravelDataTables[\"dataTableBuilder\"]=$(\"#dataTableBuilder\").DataTable({\"serverSide\":true,\"processing\":true,\"ajax\":{\"url\":\"\",\"type\":\"GET\",\"data\":function(data) {\r\n            for (var i = 0, len = data.columns.length; i < len; i++) {\r\n                if (!data.columns[i].search.value) delete data.columns[i].search;\r\n                if (data.columns[i].searchable === true) delete data.columns[i].searchable;\r\n                if (data.columns[i].orderable === true) delete data.columns[i].orderable;\r\n                if (data.columns[i].data === data.columns[i].name) delete data.columns[i].name;\r\n            }\r\n            delete data.search.regex;}},\"columns\":[{\"name\":\"id\",\"data\":\"id\",\"title\":\"Id\",\"orderable\":true,\"searchable\":true},{\"name\":\"name\",\"data\":\"name\",\"title\":\"Name\",\"orderable\":true,\"searchable\":true},{\"name\":\"email\",\"data\":\"email\",\"title\":\"Email\",\"orderable\":true,\"searchable\":true},{\"name\":\"created_at\",\"data\":\"created_at\",\"title\":\"Created At\",\"orderable\":true,\"searchable\":true},{\"name\":\"updated_at\",\"data\":\"updated_at\",\"title\":\"Updated At\",\"orderable\":true,\"searchable\":true},{\"defaultContent\":\"\",\"data\":\"action\",\"name\":\"action\",\"title\":\"Action\",\"render\":null,\"orderable\":false,\"searchable\":false,\"width\":\"150px\"}],\"dom\":\"Bfrtip\",\"order\":[[0,\"desc\"]],\"buttons\":[\"create\",\"export\",\"print\",\"reset\",\"reload\"]});})(window,jQuery);\r\n```"},"comment":{"url":"https://api.github.com/repos/yajra/laravel-datatables/issues/comments/388534017","html_url":"https://github.com/yajra/laravel-datatables/issues/1736#issuecomment-388534017","issue_url":"https://api.github.com/repos/yajra/laravel-datatables/issues/1736","id":388534017,"user":{"login":"krajdyal","id":3018383,"avatar_url":"https://avatars0.githubusercontent.com/u/3018383?v=4","gravatar_id":"","url":"https://api.github.com/users/krajdyal","html_url":"https://github.com/krajdyal","followers_url":"https://api.github.com/users/krajdyal/followers","following_url":"https://api.github.com/users/krajdyal/following{/other_user}","gists_url":"https://api.github.com/users/krajdyal/gists{/gist_id}","starred_url":"https://api.github.com/users/krajdyal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/krajdyal/subscriptions","organizations_url":"https://api.github.com/users/krajdyal/orgs","repos_url":"https://api.github.com/users/krajdyal/repos","events_url":"https://api.github.com/users/krajdyal/events{/privacy}","received_events_url":"https://api.github.com/users/krajdyal/received_events","type":"User","site_admin":false},"created_at":"2018-05-12T06:28:23Z","updated_at":"2018-05-12T06:28:23Z","author_association":"NONE","body":"No Console errors:\r\n\r\nFiles used:\r\nUserDataTable.php\r\n\r\n\r\n<?php\r\n\r\nnamespace App\\DataTables;\r\n\r\nuse App\\User;\r\nuse Yajra\\DataTables\\Services\\DataTable;\r\n\r\nclass UsersDataTable extends DataTable\r\n{\r\n    /**\r\n     * Build DataTable class.\r\n     *\r\n     * @param mixed $query Results from query() method.\r\n     * @return \\Yajra\\DataTables\\DataTableAbstract\r\n     */\r\n    public function dataTable($query)\r\n    {\r\n        return datatables($query)\r\n            ->addColumn('action', 'useraction');\r\n    }\r\n\r\n    /**\r\n     * Get query source of dataTable.\r\n     *\r\n     * @param \\App\\User $model\r\n     * @return \\Illuminate\\Database\\Eloquent\\Builder\r\n     */\r\n    public function query(User $model)\r\n    {\r\n        return $model->newQuery()->select('id', 'name', 'email','created_at', 'updated_at');\r\n\r\n    }\r\n\r\n    /**\r\n     * Optional method if you want to use html builder.\r\n     *\r\n     * @return \\Yajra\\DataTables\\Html\\Builder\r\n     */\r\n    public function html()\r\n    {\r\n        return $this->builder()\r\n                    ->columns($this->getColumns())\r\n                    ->minifiedAjax()\r\n                    ->addAction(['width' => '150px'])\r\n                    ->parameters($this->getBuilderParameters());\r\n    }\r\n\r\n    /**\r\n     * Get columns.\r\n     *\r\n     * @return array\r\n     */\r\n    protected function getColumns()\r\n    {\r\n        return [\r\n            'id',\r\n            'name',\r\n            'email',\r\n            'created_at',\r\n            'updated_at'\r\n        ];\r\n    }\r\n\r\n    /**\r\n     * Get filename for export.\r\n     *\r\n     * @return string\r\n     */\r\n    protected function filename()\r\n    {\r\n        return 'Users_' . date('YmdHis');\r\n    }\r\n}\r\n\r\n----------------------------\r\nDataTablesController.php\r\n----------------------------\r\n\r\n<?php\r\n\r\nnamespace App\\Http\\Controllers;\r\n\r\nuse App\\DataTables\\UsersDataTable;\r\nuse Illuminate\\Http\\Request;\r\nuse App\\Http\\Controllers\\Controller;\r\n\r\nclass DatatablesController extends Controller\r\n{\r\n    /**\r\n     * Display index page and process dataTable ajax request.\r\n     *\r\n     * @param \\App\\DataTables\\UsersDataTable $dataTable\r\n     * @return \\Illuminate\\Http\\JsonResponse|\\Illuminate\\View\\View\r\n     */\r\n    public function index(UsersDataTable $dataTable)\r\n    {\r\n        return $dataTable->render('welcome');\r\n    }\r\n\r\n    /**\r\n     * Show create user page.\r\n     *\r\n     * @return \\BladeView|bool|\\Illuminate\\Contracts\\View\\Factory|\\Illuminate\\View\\View\r\n     */\r\n    public function create()\r\n    {\r\n        return view('create');\r\n    }\r\n}\r\n\r\n\r\n--------------------------------\r\nwelcome.blade.php\r\n--------------------------------\r\n@extends('master')\r\n\r\n\r\n@section('content')\r\n\r\n    <div class=\"tab-content\">\r\n        <div >\r\n            <h2>Laravel Datatable </h2>\r\n            <div class=\"panel panel-default\">\r\n                <div class=\"panel-body\">\r\n                     {!!  $dataTable->table()  !!}\r\n                </div>\r\n            </div>\r\n        </div>\r\n\r\n    </div>\r\n@endsection\r\n\r\n@push('scripts')\r\n{!! $dataTable->scripts() !!}\r\n@endpush\r\n\r\n\r\n------------------------------\r\nmaster.blade.php\r\n------------------------------\r\n<!DOCTYPE html>\r\n<html lang=\"en\">\r\n<head>\r\n    <meta charset=\"utf-8\">\r\n    <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\r\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\r\n\r\n    <!-- CSRF Token -->\r\n    <meta name=\"csrf-token\" content=\"{{ csrf_token() }}\">\r\n\r\n    @section('title')\r\n    <title>Hello World</title>\r\n    @show\r\n\r\n    <!-- Styles -->\r\n    <!-- Bootstrap CSS -->\r\n\r\n      <link rel=\"stylesheet\" type=\"text/css\" href=\"//cdn.datatables.net/1.10.16/css/jquery.dataTables.min.css\"/>\r\n        <link rel=\"stylesheet\" type=\"text/css\" href=\"////cdn.datatables.net/buttons/1.5.1/css/buttons.dataTables.min.css\"/>\r\n\r\n    <!-- Scripts -->\r\n\r\n\r\n    <script>\r\n        window.Laravel = {!! json_encode([\r\n            'csrfToken' => csrf_token(),\r\n        ]) !!};\r\n    </script>\r\n</head>\r\n<body>\r\n    <div id=\"app\">\r\n        <div class=\"container\">\r\n            <div class=\"row\">\r\n                <div class=\"col-sm-12\">\r\n                    @yield('content')\r\n                </div>\r\n            </div>\r\n        </div>\r\n    </div>\r\n\r\n    <!-- Scripts -->\r\n    <!-- jQuery -->\r\n<script type=\"text/javascript\" src=\"https://code.jquery.com/jquery-3.2.1.min.js\"></script>\r\n         <!-- DataTables -->\r\n<script type=\"text/javascript\" src=\"//cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js\"></script>\r\n\r\n\r\n    @stack('scripts')\r\n\r\n</body>\r\n</html>\r\n"}}
{"actor":{"display_login":"krajdyal"}}