how to add show data button in Yajrabox

how to add show data button in Yajrabox

By : bkmz
Date : November 22 2020, 04:01 AM
help you fix your problem Im working with Laravel and im asking how can I add a button that send me to a page that can show my data I have already made it but I don't know how to add the button in Yajrabox form Im talking about this one: , You should try this:
Your Route like:
code :

 <a  href="{{ route('sujet.afficher', [$sujet->id]) }}" class="btn btn-info"> See the informations  </a>

Share : facebook icon twitter icon
Laravel and yajrabox Datatables server side proccessing

Laravel and yajrabox Datatables server side proccessing

By : shopwood
Date : March 29 2020, 07:55 AM
With these it helps here is my working example, that How I am using this.
My controller method for Datatable
code :
public function getData()

    $supplier  = Supplier::with('manufacturer')->select(['id','proprietor','qualified_person','manufacturer_id','license_no','nth_registration_no','phone','mobile','email','address','status']);

    return Datatables::of($supplier)
            ->editColumn('status', function($supplier){
             return (($supplier->status == 1)?"Active":"Deactive");
            ->editColumn('phone', function($supplier){
             return "Phone#: ".$supplier->phone." <br /> Mobile#: ".$supplier->mobile;
            ->editColumn('manufacturer_id', function($supplier){
             //return $supplier->manufacturer->name;
                if($supplier->manufacturer_id != 0){
                    return $supplier->manufacturer->name;
                    return 'Not selected!';

            ->addColumn('actions', '
                <div class="btn-group">
                    <a href="{!!route("supplier-edit",["id"=>$id ])!!}" class="btn btn-xs btn-primary"><i class="fa fa-pencil"></i></a>
                    <a href="{!!route("ajax-delete",["type"=>"supplier","id"=>$id ])!!}" data-target="#ajax_delete" data-toggle="modal" class="btn btn-xs btn-danger">
                        <i class="fa fa-trash-o"></i>

<table class="table table-bordered table-striped table-condensed flip-content" id="supplier">
    <thead class="flip-content">
            <th>Qualified Person</th>
<script type="text/javascript">
    var oTable;

    $(document).ready(function() {
        oTable = $('#supplier').DataTable({
            "responsive": true,
            "processing": true,
            "serverSide": true,
            "ajax": "{!!route('supplier-data')!!}",
            "columns": [
                {data: 'manufacturer_id',              name: 'manufacturer_id'},
                {data: 'qualified_person',              name: 'qualified_person'},
                {data: 'proprietor',              name: 'proprietor'},
                {data: 'license_no',              name: 'license_no'},
                {data: 'nth_registration_no',              name: 'nth_registration_no'},
                {data: 'phone',             name: 'phone'},
                {data: 'email',             name: 'email'},
                //{data: 'mobile',            name: 'mobile'},
                {data: 'address',           name: 'address'},
                {data: 'status',            name: 'status'},
                {data: 'actions',           name: 'actions'},
public function getData()

    $medicine  = Medicine::with(['manufacturer','doseageForm','measureUnit','supplier'])

    return Datatables::of($medicine)
            ->editColumn('status', function($medicine){
                return (($medicine->status == 1)?"Active":"Deactive");
            ->editColumn('manufacturer_id', function($medicine){

                $manufacturer_name   =   $medicine->manufacturer->name;
                return $manufacturer_name;
            ->editColumn('product_name', function($medicine){
                    $medicine->product_name.", ".
                        $medicine->doseageForm->name.", ".

                if($medicine->supplier->count() > 0){
                    return $medicine->supplier->first()->qualified_person;
                    return '---';

            ->addColumn('actions', function($medicine){

                $edit_route =   route('medicine-edit',['id'=>$medicine->id ]);
                $del_route  =   route("ajax-delete",["type"=>"medicine","id"=>$medicine->id ]);

                $status     =   (($medicine->status == 1)?
                                    '<a href="" class="btn btn-xs btn-warning"><i class="fa fa-eye"></i></a>'
                                    '<a href="" class="btn btn-xs btn-warning"><i class="fa fa-eye-slash"></i></a>'

                $html       =   '<div class="btn-group">
                                    <a href="'.$edit_route.'" class="btn btn-xs btn-primary" alt="edit"><i class="fa fa-pencil"></i></a>
                                    <a href="'.$del_route.'" data-target="#ajax_delete" alt="delete" data-toggle="modal" class="btn btn-xs btn-danger">
                                        <i class="fa fa-trash-o"></i>

                return $html;

add global setting to datatables yajrabox laravel

add global setting to datatables yajrabox laravel

By : MFB
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , I use yajrabox data tables and I want to add the public option to all tables This plugin needs to select a selector or table. How can I fine-tune my preferences without choosing it , I am not sure but please try this
code :
(function ($, DataTable) {

$.extend(true, DataTable.defaults, {
    sProcessing: "<div class='fa-3x'><i class='fas fa-spinner fa-spin'></i></div>"          

Laravel, Yajrabox Datatables - table not displaying rows

Laravel, Yajrabox Datatables - table not displaying rows

By : user2722843
Date : March 29 2020, 07:55 AM
will be helpful for those in need My page loads correctly and but the data rows do not show. I've been using a video tutorial and copying it best I can for my own project. I have put my code below and I would really appreciate any help. I'm really struggling to understand hjow datatable integrate with laravel. , In Your DatatablesController
code :

 namespace App\Http\Controllers;

 use Illuminate\Http\Request;
 use Yajra\Datatables\Datatables;
 use App\Activity;

 class DatatablesController extends Controller

   public function getIndex()
    return view('activities.index');

    public function getData() {

    return Datatables::of($query)->addColumn('id', function ($query) {
        return $query->id;
    })->addColumn('when', function ($query) {

        return $query->created_date;
    })->addColumn('activity', function ($query) {
        return $query->activity;
    })->addColumn('learned', function ($query) {
        return $query->learned;
    })->addColumn('role', function ($query) {

         return $query->role;
    })->addColumn('hours', function ($query) {

        return $query->hours;
    })->addColumn('name', function ($query) {
        return $query->user_id;



$(document).ready( function () {
} );


    .grid33 {

        width: 100vw;
        display: grid;
        width: 100%;
        grid-template-columns: 1fr minmax(750px, 6fr) 1fr;
        grid-template-rows: 40px 6fr 1fr;
            "left head right"
            "left main right"
            "left foot right"; 

    .datatable {
        grid-area: main;
    .datafooter {
        grid-area: foot;

    .datahead {
        grid-area: head;


  <div class="grid33">
    <div class="datahead">
    <div class="datatable">
            <table class="table" id="actvities-table">
                        <th scope="col">#</th>
                        <th scope="col">Month/Year</th>
                        <th scope="col">Course / Guided Learning / Training 
                        <th scope="col">What New/Increased Skills/Knowledge 
                        <th scope="col">How Does This Apply To Your 
                        <th scope="col">Training Hours</th>
                        <th scope="col">User</th>

            <a href="/activities/create" class="btn btn-outline-primary btn-sm 
     float-right">Add an activity</a>

    <div class="datafooter">



        $(function() {
                processing: true,
                serverSide: true,
                ajax: '{!! route('get.activities') !!}',
                columns: [
                    { data: 'id', name: 'id' },
                    { data: 'when', name: 'when' },
                    { data: 'activity', name: 'activity' },
                    { data: 'learned', name: 'learned' },
                    { data: 'role', name: 'role' }
                    { data: 'hours', name: 'hours' }
                    { data: 'user', name: 'user' }
Laravel 5.8 / Yajrabox-datatables - Setting up a service

Laravel 5.8 / Yajrabox-datatables - Setting up a service

By : user2757972
Date : March 29 2020, 07:55 AM
should help you out Okay,
I was using a guide that was for an older version of yajra-datatables.
Sorting in Yajrabox datatable by Eloquent accessor field

Sorting in Yajrabox datatable by Eloquent accessor field

By : user2871228
Date : March 29 2020, 07:55 AM
To fix the issue you can do To elaborate on my comment, here an answer.
You cannot use virtual properties (e.g. your desired getFullNameAttribute()) for sorting and filtering. Even if it worked, it would be executed in-memory as these accessors cannot be translated to SQL by Laravel automatically.
code :
class UserDataTable extends DataTable
    public function query(): \Illuminate\Database\Query\Builder
        return DB::query()->fromSub(
                    DB::raw("CONCAT(first_name, ' ', last_name) as full_name")

    protected function getColumns(): array
        return [
            ['data' => 'first_name', 'title' => 'First Name'],
            ['data' => 'last_name', 'title' => 'Last Name'],
            ['data' => 'full_name', 'title' => 'Full Name'],
public function dataTable($query): DataTableAbstract
    /** @var QueryDataTable $dataTable */
    $dataTable = datatables($query);

    return $dataTable
        ->editColumn('first_name', function ($user) {
            /** @var User|\stdClass $user */
            return ucfirst($user->first_name);
Related Posts Related Posts :
  • How to read Protocol Buffers delimited I/O functions
  • Creating a link from Google Chart timeline item
  • Rewrite PHP variables from URL with .htaccess
  • Undesired output for php array creation
  • Symfony 4 - custom authentication FosUserBundle
  • laravel: cant push object property to array
  • When sharing on facebook, showing angular brackets in title and decription
  • Undefined function: 7 ERROR: operator does not exist: public.ltree public.< public.ltree[]
  • Generate a CSV in php from Array or Object
  • LibreOffice convert PDF to Word as textbox instead normal document
  • php laravel swift email sending problems
  • Reload PHP file in command line PHP-CLI
  • how do I fetch a certain part out of an database?
  • CodeIgniter URL Route with ID and title
  • Add a header to each column
  • How can I loop stdClass in PHP?
  • Four arrays in for each loop
  • bootstrap 4 cards with php foreach loop
  • Codeigniter return not found on the server
  • PHP Codeigniter Do Upload Function Does Not Work
  • Implement REST API Symfony 3
  • My WampServer doesnt have apache setting in tray icon
  • Translate checkout fields validation error notices in Woocommerce
  • Embedding nested form type fields in empty symfony form
  • PHP Laravel orderby not working if using `count`
  • Laravel 5.7 my model from my parameter return's empty when i dump it
  • How to pass input value as array instead of passing only one value where array_walk is used in PHP?
  • Replace illegal charactes in a text by underscore in PHP
  • PHP / JSON - Return large string result in error
  • Yii2 DI container: registering same class twice, but with different constructor parameters
  • Creating Subdirectories with a for loop
  • Wordpress get most popular posts in current post category
  • Replace linebreak in specific piece of text in file
  • Update database that has same key with using a new different values
  • Problems with Curl in Discord Oauth2
  • How to remove all lines in file till a specific word occures PHP
  • How to use Join in Codeigniter for update Query
  • PHP DOMDocument: may a text node be reused?
  • How to read Armenian texts from Laravel MSSQL database
  • How to view image and pdf files preview in yii2 kartik multiple file upload in update form
  • Which one is best and faster method ?(making drop down method)
  • Using preg_match to get content between tags
  • Laravel 5.7 Eloquent
  • How to combine array inside foreach loop
  • Wordpress-Stripe Integration: Fatal error: Uncaught Error: Class 'Stripe' not found
  • Redirect user to original url from age verification
  • How to update only one input in Laravel form?
  • How to add language translation in JSON file in prestashop
  • Interface 'Monolog\ResettableInterface' not found when running a new project
  • Adding strings when using echo in foreach PHP
  • do-while loop only runs once
  • Need to trim string
  • Increment ID by one on duplicate with PHP
  • insert current date time using laravel
  • call_user_func_array("shell_exec", ...) not working in php
  • PHP Time Validator to accept 1 digit number for hour and minutes
  • How to swap element according to condition in PHP where there is array_map?
  • PHP Compress Image and rename
  • PHP 'Delete all between' specific words
  • PHP - Show database values in text boxes
  • shadow
    Privacy Policy - Terms - Contact Us © bighow.org