【问题标题】:how to checked input checkbox datatable laravel?如何检查输入复选框数据表laravel?
【发布时间】:2021-11-10 17:59:04
【问题描述】:

如果 is_participant 是 1,我想发表声明,然后选中该框,但我尝试了但它不起作用

$user = User::with('regency.province');
        return DataTables::of($user)
            ->editColumn('is_participant', function ($user) {
                return '<input ' . $user->is_participant == 1 ? "checked" : "" . ' type="checkbox" id="' . $user->id . '">';
            })

我的代码中是否缺少某些内容

【问题讨论】:

    标签: javascript html jquery ajax laravel


    【解决方案1】:

    尝试应用以下代码。我试图以 PHP 接受的方式更改报价格式。

    ->editColumn("is_participant", function ($user) {
             $checked = ($user-> is_participant == 1) ? 'checked' : '';
             return ' <input type="checkbox" id="' . $user->id . '" ' . $checked . '> ';
      });
    

    【讨论】:

      猜你喜欢
      • 2016-10-25
      • 1970-01-01
      • 2018-06-29
      • 1970-01-01
      • 2019-11-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多