-
Notifications
You must be signed in to change notification settings - Fork 915
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Field definition should include field size and separate html attributes #30
Comments
Done. Works in CRUD 2.1 like this: $this->crud->addFields([
// mandatory
'name' => 'name',
'type' => 'text',
'label' => 'Name',
// optional
'attributes' => [
'disabled' => 'disabled',
'style' => 'border: 1px solid red',
...
],
'wrapperAttributes' => [
'class' => 'col-md-6',
'style' => 'border-top: 1px solid #eee; margin-top: 10px;'
]
]); |
thanks! |
Hi @nilsE , Nope, column fields don't have any attributes on them. My thought was that if you need to add some attributes, you probably need some HTML too. So then it's just easier to create a new column type. I could be wrong though, how would you have used the column attributes if they were there? Cheers. |
@tabacitu I think you're right, i played around a little with columns and created my own custom type, it's very flexible this way. And there's the $column object so i can use my own attributes in the column definition and template, e.g. {{$column['label_class']}} btw: after poking around with many laravel boilerplates, crud generators and even cms frameworks i ended up using backpack for my actual project and i'm VERY happy with it! |
:-) I'm very glad to hear that. Really. Seeing people using the packages is the only thing that makes this worthwhile. Cheers! |
But if I want to change custom field width? ... write new field type?) |
Aurel Drăguţ came with a great idea in order to allow developers to build 2-column layouts, 3-column layouts, etc in their forms.
Just by allowing the developer to place an extra class on the parent form element
we would be able to easily build panels that look like this:
![screen shot 2016-06-09 at 09 57 50](https://cloud.githubusercontent.com/assets/1032474/15921228/b1e04422-2e28-11e6-9157-e1d778940a2a.png)
This would imply a certain syntax change, so the change should come at the same with @cristiantone 's proposition to separate the HTML attributes sent to the input/textarea/select/etc.
Here's the new proposed syntax for the "text" field type:
@Ghitu , @cristiantone , @mariusconstantin2503 , what do you think?
The text was updated successfully, but these errors were encountered: