laravel-admin icon indicating copy to clipboard operation
laravel-admin copied to clipboard

Model popup using AJAX to show current contents and icon change

Open technilogics opened this issue 1 year ago • 3 comments

  • Laravel Version: 9
  • PHP Version: 8.0.9
  • Laravel-admin: 1.8.17

Description:

I am using Grid Column Model to load Related Notes, but unfortunately it has 2 issues

  1. Icon for Column is always Clone icon, there is no way to change it Screenshot 2022-12-20 at 19-42-27 Admin Orders
  2. All popup data is loaded with page load, how to load it using AJAX on Icon click, so latest records can be shown.

Steps To Reproduce:

`$grid->column('notes', __('Notes'))->display(function ($title, $column) { $notes = $this->notes()->with('admin:id,name')->take(10)->orderBy('id','desc')->get()->map(function ($note) { //return $note->only(['id','description','admin_user_id' , 'created_at']); return [$note->id,nl2br($note->description ."\n\r\n\rBy ".$note->admin->name ." @ ".date("d/m/Y h:i A",strtotime($note->created_at)))]; }); // dd($notes->flatten()->toArray()); // Otherwise it is displayed as editable if(count($notes)>0){ //Show Icon, and show Notes in model popup if count greater than 0 return $column->modal('Latest Notes', function ($column) use($notes) { return new Table(['ID', 'Description'], $notes->toArray(),['table-striped']); //return new Box('No Information', 'There is no note to show'); });

}else{
  return "-";//Donot show Icon
}

});`

technilogics avatar Dec 20 '22 14:12 technilogics