Category : datatables

I am using datatable in Laravel Project. I use it on many pages. But on two pages I need to show almost 20 columns. and it automatically adds a plus sign to show more details. I have filters on table and following is my JavaScript. $(document).ready(function() { initDatatable(‘/deals/deals_table’, ‘deals_table’); }); function quickFilter(elementId) { var fnServerParams ..

Read more

I have the following model that has a belongsToMany relationship: class Sale extends Model { public function items() { return $this->belongsToMany(Item::class)->select( [DB::raw("COUNT(*) as quantity"), DB::raw("CONCAT(‘(‘, GROUP_CONCAT(serial_number SEPARATOR ‘, ‘), ‘)’) AS serial_number"), ‘items.name’, ‘items.upc’, ‘items.id’, ‘items.with_serial_number’, ‘items.selling_price’, ‘item_sale.sold_price’, ‘item_sale.item_purchase_id’]) ->join(‘item_purchase’, ‘item_sale.item_purchase_id’, ‘=’, ‘item_purchase.id’) ->orderBy(‘item_sale.id’, ‘ASC’) ->groupBy(‘item_sale.item_id’, ‘item_sale.sale_id’); } and on my controller public function demo(Request ..

Read more

I want to know how to display multiple images that is stored in the database as an array : ["img1.jpeg","img2.png"] Here is my controller. In my case only one image is displayed in the datatable. if ($request->ajax()) { $data = Actualite::latest()->get(); return Datatables::of($data) ->addIndexColumn() ->editColumn(‘created_at’, function ($data) { return $data->created_at->format(‘Y-m-d’); // human readable format }) ..

Read more

I know this is a common issue but I have tried returning my data as json but I cannot seem to display data on my datatables since yesterday. I am running Laravel 8.55. User migration $table->bigIncrements(‘id’); $table->string(‘firstName’)->nullable(); $table->string(‘lastName’)->nullable(); $table->string(‘mobile’)->unique()->nullable(); $table->string(’email’)->unique()->nullable(); UserDataTable public function query(User $model) { return $model->newQuery() ->orderByDesc(‘users.id’); } protected function getColumns() { return ..

Read more

tell me how can I add a server-side datatable script to a controller method that I access via ajax.So that it can be accessed via routing.Everything else seems to be correct. But I can’t figure out how to make the server part in laravel correctly. server-script include("../../../vendor/datatables.net/editor-php/DataTables.php"); use DataTablesEditor, DataTablesEditorField, DataTablesEditorFormat, DataTablesEditorMjoin, DataTablesEditorOptions, DataTablesEditorUpload, DataTablesEditorValidate, ..

Read more

I followed all the tutorials from this link to create a date range filter and it worked but when I tried the results of the input it came out in an incorrect format, https://datatables.net/extensions/datetime/examples/integration/datatables.html my data table record which was originally of type timestamps, I changed the format using carbon to Y-m-d, which I asked ..

Read more

in my laravel 8 app with jquery 3.4/bootstrap 4.6 I use dataTable 1.10.19 and I try to add more custom filters and when user enter in search input: @section(‘footerscripts’) <script src="{!!admin_assets!!}/plugins/custom/datatables/datatables.bundle.js"></script> <script> var oTable= null $(document).ready(function () { initEducations() … function initEducations() { var filter_education_category_id = $("#filter_education_category_id").val() var filter_document_type = $("#filter_document_type").val() var url= ‘educations_filter/1/’+filter_education_category_id + ..

Read more

referencia de la pagina datatables.net el inconveniente se presenta en cargar la data cuando se produce el ciclo for, solo muestra los datos de la consulta no carga los datos en tabla, una vez que se elimina las lineas del ciclo for carga el script datatables <head> <link rel=”stylesheet” href=”https://cdn.datatables.net/1.10.25/css/jquery.dataTables.min.css”> </head> <body> <table id=”demo” class=”table ..

Read more

I’m getting an error when trying to setup a datatables with my laravel project. DataTables warning: table id=DataTables_Table_0 – Ajax error. For more information about this error, please see http://datatables.net/tn/7 This is my controller. namespace AppHttpControllers; use IlluminateHttpRequest; use AppTransaction; use DataTables; use IlluminateSupportFacadesDB; class TestTableController extends Controller { public function index() { return view(‘testtable’); ..

Read more

I have a dropdown menu inside a yajra datatable. That menu is built using the addColumn function and is working fine on desktop. However on mobile, the menu doesn’t show on click. Here is my code: ->addColumn(‘status’, function($orders) use ($orderStatuses){ $headerElement = ‘<span id="selectedValue" class="center-align dropdown-trigger chip lighten-4 ‘. $orders->status->styles .’" data-target="status-options-‘.$orders->id.’" style="width: 110px;">’. $orders->status->localized ..

Read more

Hello I am using laravel Yajra datatables, the matter is that I have a 2 variables created in a function with the name of the id. This is all the code <?php namespace AppHttpControllersDatatables; use AppUser; use CarbonCarbon; use YajraDataTablesDataTables; use AppReportes; class ReportesDatatable { public function ReportesDatatable() { $reportes = Reportes::get(); return Datatables::of($reportes) ->editColumn(‘reportante’, ..

Read more

How can I exclude data based on my condition on the addColumn function? What I tried is this but it will include records that are > 0 ->addColumn(‘total’, function ($row) { $arr = array(abs($row->fba_fee_count),abs($row->referral_fee_count)); if($arr > 0){ return array_sum($arr); } On the frontend side, I also tried "createdRow": function( row, data, dataIndex ) { if ..

Read more