Category : datatable

I have use Yajra datatables in my Laravel project, but there is a problem when sorting (also searching) datatables. column ‘created_at’ in order clause is ambiguous I know that this error is because other tables has ‘created_at’ column. but I don’t know how to fix it. Here is my controller: public function index() { $partners ..

Read more

I have invoices table, which uses yajra laravel datatable. I want to filter data using ‘created_at‘ column, which does exists in invoices table in the database but not in the table view. Here is my datatable image: and the code which takes start and end dates: $(function() { $(‘#invoices_daterange’).daterangepicker({ opens: ‘left’ }, function(start, end, label) ..

Read more

I’m trying to store data into a database and I encountered a situation where I don’t know is it feasible or not to do that. so I have two following tables in the database public function up() { Schema::create(‘castings’, function (Blueprint $table) { $table->increments(‘id_casting’); $table->string(‘nom’); $table->string(‘prenom’); $table->string(‘cine’); $table->date(‘date_naissance’); $table->string(‘lieu_naissance’); $table->integer(‘mineur’)->default(‘0’); $table->integer(‘id_representant’)->nullable()->unsigned(); $table->timestamps(); $table->foreign(‘id_representant’)->references(‘id_representant’)->on(‘representants’); }); } ..

Read more

I have a problem with filtering datatable through relationships. I have a table with the main model with the various relationships and I need to filter concatenated name and surname It doesn’t came out any error but does not find any results Controller: $data = Repair::with(‘clients’,’categories’,’brands’,’modells’,’typeRepairs’,’states’,’stateClients’) ->select("*"); return Datatables::of($data) ->addIndexColumn() ->filterColumn(‘nomecognome’, function($query, $keyword) { $query->whereHas("clients", ..

Read more

i want to make my select format sql data searchable on datatable but i dont know how to put it. if its just normal column, we can just put the column name on datatable "name:" operation. but this one is a generated column. thanks in advance $query = Requests::select([ ‘requests.id as id’, ‘requests.current_status as current_status’, ..

Read more

I have a data table but instead of displaying two buttons on the action column it rather displays the HTML code so what cold be the problem. <tbody> @foreach ($subjects as $key => $subjects) <tr> <td class="bs-checkbox "><input data-index="0" name="btSelectItem" type="checkbox"></td> <td>{{$key+1}}</td> <td>{{$subjects->name}}</td> <td>{{$subjects->description}}</td> <td>@if ($subjects->status==1) Active @else Deactivated @endif </td> <td> <div class="btn-group"> <a ..

Read more

I wanted to fetch data from two tables using inner join in Laravel 8 and show it in front end as datatable by Ajax. But ajax call is returning internal server error. Here is my controller if(request()->ajax()) { return datatables()->of(Machine::select("machine_base.id as id", "machine_base.machine_name as machine_name", "machine_base.machine_category as category_id", "item_category_base.category as category_name")) ->innerJoin("item_category_base", function($join){ $join->on("item_category_base.id", "=", ..

Read more

I am applying date range filter with the help of package yajra laravel . but it returns me error as "DataTables warning: table id=order_table – Invalid JSON response. For more information about this error, please see http://datatables.net/tn/1" Please suggest some solution. This is my view code <main id="main-container"> <!– Page Content –> <div class="content"> <h2 ..

Read more

Iam trying to display data on a datatable, I am getting following error Exception Message: App/Transaction::shipping_address must return a relationship instance. ->addColumn(‘shipping_address’, function ($row) { if($row->shipping_address==NULL || trim($row->shipping_address)==”) { return "Un Assigned"; } else { return $row->shipping_address; } }) Sourc..

Read more

I want to Put a single column in the child row of multiple parent columns in datatable/yajra datatable. till now I have done this much but don’t know how to put a single column below multiple columns. ‘columns’: [ { ‘data’: ”, ‘name’: ”, "defaultContent": ""}, // { ‘data’: ‘website_url_value’, ‘name’: ‘website_url_value’}, { data: null, ..

Read more

I am having a problem in relation search query. Due to my other two db table from different DB server. Example code on below UserWallet(Main DB) morphTo (Different DB server) "[MemberWallet/GuestWallet/StaffWallet]::class" relationship hasOne "account" When i running this script, i getting this error -> Instantiation of ‘Closure’ is not allowed It look like different connection ..

Read more

i’m got stuck for 2 days, i got confused how to render column usind yajra/laravel-datatable i’m using postgre as database, and yajra/laravel-datatables as package. i have query builder like this $data = DB::select("SELECT * FROM get_list_count_amount_transaction(‘chat’, ‘done’, ‘2019-03-01’, ‘2021-12-31’ )")[0]; which generates a value of object : (i use var_dump() to see the value) { ..

Read more

Iam working on Laravel project.. I face a problem with this Datatable it keep giving me "DataTables warning: table id=customer-table – Invalid JSON response. For more information about this error, please see http://datatables.net/tn/1" and I tried to dd($items) in controller but nothing hsppens I think it not seeing the function can you help me? my ..

Read more

I am currently showing data of mine and my friend in yajra laravel datatable but I want to change color of row which have data of my friends. this is how I got data of two different users $user = Auth::user(); $friend_ids = $user->friends()->pluck(‘friend_id’)->toArray(); $posts = PostModel::whereIn(‘users_id’, $friend_ids) ->leftJoin(‘users’, ‘posts.users_id’, ‘=’, ‘users.id’) ->orWhere(‘users_id’,auth()->user()->id) ->select(‘posts.id as ..

Read more

this is the code im using to fill my datatable, but no data is printed, this is the route i create to access data, i can see it when i acces directly with the web: Route::get(‘listsolicitudes/solicitudes’,’[email protected]’)->name(‘datatable.solicitudes’); And this is the script I am using: $(function() { $(‘#tablesolicitud’).DataTable({ "ajax":{ "url": "{{route(‘datatable.solicitudes’)}}", "dataSrc": "" }, "columns": [ ..

Read more

this is the code im using to fill my datatable, but no data is printed, this is the route i create to access data, i can see it when i acces directly with the web: Route::get(‘listsolicitudes/solicitudes’,’[email protected]’)->name(‘datatable.solicitudes’); And this is the script I am using: $(function() { $(‘#tablesolicitud’).DataTable({ "ajax":{ "url": "{{route(‘datatable.solicitudes’)}}", "dataSrc": "" }, "columns": [ ..

Read more