How to use some field pro in List Operation. #767
-
I use select2_from_array (pro version) in Create Operation then it work. But, when I use in List Operation then it not work. It understand as Select_from_array. How to fix it? CRUD::addField([
'name' => 'select2',
'type' => 'select2_from_array',
'options' => [
1 => 'a'
2 => 'b'
3 => 'c'
],
'default' => '',
'wrapper' => ['class' => 'form-group col-md-1'],
]); In Blade: <div class="card">
<div class="card-body row">
@include('crud::inc.show_fields', ['fields' => $crud->fields()])
</div>
</div> |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
Hey @THAIANH98
In case you want editable columns inside the list operation. This would require our editable-columns package. Let me know if I'm missing something. Happy Coding! |
Beta Was this translation helpful? Give feedback.
-
Hi @karandatwani92, I understand what you say. But I wrote this code in custom.blade.php <div class="card">
<div class="card-body row">
@include('crud::inc.show_fields', ['fields' => $crud->fields()])
</div>
</div> I retrieve the data using this code View::composer('admin.project.form_search', function ($view) {
CRUD::addField([
'name' => 'select2',
'type' => 'select2_from_array',
'options' => [
1 => 'a'
2 => 'b'
3 => 'c'
],
'default' => '',
'wrapper' => ['class' => 'form-group col-md-1'],
]);
$view->with('crud', $this->crud);
Widget::add()->to('before_content')->type('div')->class('row')->content([
[
'type' => 'view',
'view' => 'custom',
]
]);
}); and it understands that it is select_from_array. How to it understands that it is select2_from_array? Thanks |
Beta Was this translation helpful? Give feedback.
-
OK @THAIANH98 are you trying to use CRUD fields in the list operation via the Widget section(before_content)? Let's assume somehow we did that. but how you are assuming they will work? I believe, using CRUD fields here can't get all this in list operation. (Fields are not written to work inside list operation) Now let's assume you have something else in your mind!Now let's focus back on your question. The problem must be the missing selec2/CSS resources. Why it's not loading the resources? Where as list operation uses Thus, you have to include resources by yourself. I hope this helps to understand better. |
Beta Was this translation helpful? Give feedback.
OK @THAIANH98
are you trying to use CRUD fields in the list operation via the Widget section(before_content)?
Let's assume somehow we did that. but how you are assuming they will work?
It will require a form, an action. a URL to submit or an Ajax setup, further validation - error messages, etc.
I believe, using CRUD fields here can't get all this in list operation. (Fields are not written to work inside list operation)
Now let's assume you have something else in your mind!
Now let's focus back on your question.
The problem must be the missing selec2/CSS resources.
@basset('https://unpkg.com/[email protected]/dist/css/select2.min.css')
@basset('https://unpkg.com/[email protected]…