z-song / laravel-admin

Build a full-featured administrative interface in ten minutes
https://laravel-admin.org
MIT License
11.13k stars 2.81k forks source link

The editable is not working? #5755

Open jesnagifto opened 1 year ago

jesnagifto commented 1 year ago

Description:

my code is

protected function form($id = null)

{

  return   Admin::form(Catchsummary::class, function (Form $form) use($id){

     $form->model()->id;
     $form->datetime('tripST', __('Start Date'))->readonly();
    $form->datetime('tripET', __('End Date'))->readonly();
    $form->text('return_hbr_name', __('Reutrn Harbur Name'))->readonly();
    $form->text('avg_price_fish', __('Average Fish Price'))->readonly();
    $form->text('fsh_spcs_name', __('Fish Species Name'))->readonly();
    $form->text('avg_qnty', __('Quantity'))->readonly();
    $form->text('remarks', __('Remarks'))->readonly();
    //$form->select('approval_status')->options(Catchsummary::all()->pluck('approval_status'));

       $form->tools(function (Form\Tools $tools) {

        $tools->disableDelete();

    $tools->disableView();

}); 
 $form->footer(function ($footer) {
    // disable reset btn
    $footer->disableReset();
    // disable submit btn
    $footer->disableSubmit();
    // disable `View` checkbox
    $footer->disableViewCheck();
    // disable `Continue editing` checkbox
    $footer->disableEditingCheck();
    // disable `Continue Creating` checkbox
    $footer->disableCreatingCheck();
});

    $grid = Admin::grid(Operations::class, function (Grid $grid) use($id)
   {   

     $grid->column('id', __('ID '));  
        $grid->column('registers.first_name', __('UserName'));
     $grid->column('fishname', __('Fish Name'));
    $grid->column('image', __('Image'))->image('',60,60);
    $grid->column('location', __('Locataion '));
    $grid->column('adm_remarks', __('Remarks'))->editable('textarea');
  $grid->column('approval_status', __('Approval status'))->editable('select', [0 => 'Pending', 1 => 'Verified',2 => 'Rejected']);

   $grid->disableCreateButton();
    $grid->disableExport();
       });     

$form->html($grid->render())->setWidth(12);

  });

Steps To Reproduce:

2023-04-18

jesnagifto commented 1 year ago

plz help me fast

Ladel commented 1 year ago

Read the documentation

Note: For each column edit setting, you need to have a corresponding field in the form.

jesnagifto commented 1 year ago

that's ok but how to add to this?

Ladel commented 1 year ago

Your need create OperationsController and add form function

or

Something like this

  public function update_operation($id)
  {
      return Admin::form(Operations::class, function (Form $form) {
          $form->textarea('adm_remarks');
          $form->text('approval_status');
      })->update($id);
  }

add to app\Admin\routes.php file

$router->put('operations/update/{id}', 'YOURCLASSController@update_operation')->name('operations.update');
acoooder commented 10 months ago

that's ok but how to add to this?

hello,这个问题你搞定了吗?查了一天了没搞定这个行内编辑怎么用,文档太简略了,对新手有点难。。。。

版本是V1.8.10,谢谢。