Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataTable warning tableid=data table builder Ajax Error #598

Closed
r17x opened this issue Jun 8, 2016 · 1 comment
Closed

DataTable warning tableid=data table builder Ajax Error #598

r17x opened this issue Jun 8, 2016 · 1 comment

Comments

@r17x
Copy link

r17x commented Jun 8, 2016

Summary of problem or feature request

Code snippet of problem

Controller.php

`
namespace App\Http\Controllers;
use Session;
use Illuminate\Http\Request;
use App\Model\Persuratan;
use App\Http\Requests;
use App\DataTables\ArsipTable;

class AdminController extends Controller
{
   public function arsip(ArsipTable $dataTable){
        return $dataTable->render('admin.arsip.index');
    }
}`

* ArsipTable.php*

`<?php

namespace App\DataTables;

use App\Model\Persuratan;
use Yajra\Datatables\Services\DataTable;

class ArsipTable extends DataTable
{
    // protected $printPreview  = 'path.to.print.preview.view';

    /**
     * Display ajax response.
     *
     * @return \Illuminate\Http\JsonResponse
     */
    public function ajax()
    {
        return $this->datatables
            ->eloquent($this->query())
            ->addColumn('action',  function($id){
            $button = '<form action="/adm/arsip/'.$id->id.'" method="POST">'.'<a href="/adm/arsip/'.$id->id.'" class="btn btn-sm btn-warning" title="Ubah Surat"><i class="fa fa-edit"></i></a>';
            $button .= '
            <button type="submit" class="btn btn-sm btn-danger"><i class="fa fa-trash"></i></button>
            <input type="hidden" name="_method" value="DELETE">
            </form';
            return $button;
        })->make(true);
    }

    /**
     * Get the query object to be processed by datatables.
     *
     * @return \Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder
     */
    public function query()
    {
        $persuratan = Persuratan::select();
        return $this->applyScopes($persuratan);
    }

    /**
     * Optional method if you want to use html builder.
     *
     * @return \Yajra\Datatables\Html\Builder
     */
    public function html()
    {
        return $this->builder()
                    ->columns(['no_surat', 'tujuan', 'jenis','ket','created_at','lampiran','action' => ['orderable' => false, 'searchable' => false] ])
                    ->parameters($this->getBuilderParameters());
    }

    /**
     * Get columns.
     *
     * @return array
     */
    private function getColumns()
    {
        return ['no_surat', 'tujuan', 'jenis','ket','created_at','lampiran'];
    }

    /**
     * Get filename for export.
     *
     * @return string
     */
    protected function filename()
    {
        return 'ArsipTable';
    }
}
`

System details

  • Operating System Win 10 With Using XAMPP
  • PHP Version Apache/2.4.10 (Win32) OpenSSL/1.0.1i PHP/5.5.15
  • Laravel Version 5.2.35
  • Laravel-Datatables 6.11.5

Image
when I click pagination , order , search , and select entries in the table shows the error datatables.net/tn/7 datatables.
image
sorry ! my english is bad

@yajra
Copy link
Owner

yajra commented Jun 12, 2016

@ri7nz I think this is an environment related issue where routes intermittently returns NotFound exception. There are several closed issues like this and most of are them are related to artisan serve. I suggest you use homestead if possible. Thanks!

@yajra yajra closed this as completed Jun 12, 2016
@github-actions github-actions bot locked and limited conversation to collaborators Nov 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants