-
Notifications
You must be signed in to change notification settings - Fork 31
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
How to pass classes, when creating table through array? #7
Comments
Currently, adding classes is only supported when adding columns programmatically (i.e. using |
well this change would make controller action much cleaner to read the code, and actual example of this table creation with array would make more sense compared to that separate column addition. but all in all, thank you for providing such useful code for open public, this saves so much time when trying to add fast sorting to your project. i hope, that this would become more popular in future, because i just couldn't find anything similar to this :) thank you for your great contribution! |
Thank you for the kind words! Considering this further, I probably wouldn't use it that way; I like keeping controllers as simple as possible, while putting every bit of HTML and HTML logic within view files. But, I also appreciate that everyone does things in their own way, and more options is never a bad thing. 👍 |
well, actually the correct way (atleast from my perspective) is to place the query for data inside controller (as little as possible), and then worry about the display itself in the view files. that building of columns might be logical inside views, but i like to give structured data from controller and the view files control only the display, not what to display and what not. but you are right, everyone has their own style, and if there are more customization - it's only for the better. i hope you will keep this library alive, but i also know that such things cost time and you are not getting anything back, just kind words. but people like you are the ones who make programming such an awesome experience ;) |
Wouldn't it just work if you used the |
I can confirm what drclaw suggests - it works if you use |
$table = Table::create($rows, [
'id' => '',
'name' => ['label' => trans('projects.index_label_name'), 'class' => 'test-class'],
'estimate' => trans('projects.index_label_estimate'),
'asignees' => trans('projects.index_label_asignees'),
'status' => trans('projects.index_label_status'),
'start' => trans('projects.index_label_start'),
'end' => trans('projects.index_label_end'),
]);
in this example, i'm trying to achieve the same thing as in example that you have provided with addClass() method:
$table->addColumn('status_id', trans('tasks.status'), function($model) {
return $model->getStatusName();
})->addClass('fw-150 hidden-xs');
is this possible with current release or do you plan on extending this library in future to support this?
The text was updated successfully, but these errors were encountered: