Skip to content
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

GridView display issue when it has many columns and/or columns have long name #8771

Closed
michaelnguyen2021 opened this issue Jun 12, 2015 · 4 comments
Assignees
Labels
Milestone

Comments

@michaelnguyen2021
Copy link

The culprit is

.grid-view th {
    white-space: nowrap;
}

under web\css\site.css for default template
or frontend\web\css\site.css and backend\web\css\site.css for advance template

With white-space: no-wrap

before

With white-space: no-wrap and

[
    'attribute' => 'st_hourly_billable',
    'format' => 'currency',
    'headerOptions' => ['style' => 'max-width: 50px']
],

other
Remove white-space: no-wrap
after

Remove white-space: no-wrap and use

[
    'attribute' => 'st_hourly_billable',
    'format' => 'currency',
    'headerOptions' => ['style' => 'max-width: 50px']
],

other_001

@cebe
Copy link
Member

cebe commented Jun 14, 2015

as far as I remember no-wrap has been added to avoid that the sort icon would be on the next line. maybe there is a better way to force it to be after the last word in the same line.

@YaroslavShapoval
Copy link

I think there can be a few solutions (example on advanced template):

Add css-class on every parent cell of ActionColumn and add no-wrap only for these columns.

common/confog/bootstap.php

\Yii::$container->set('yii\grid\ActionColumn', [
    'contentOptions' => [
        'class' => 'action-column'
    ]
]);

Change web/css/site.css

/* from */
.grid-view th {
    white-space: nowrap;
}

/* to */
.action-column {
    white-space: nowrap;
}

It is also possible to rename action-column to nowrap and add this css-class everywhere if necessary.

It is also possible to use deprecated attribute for td tag (nowrap): link to specification

@SilverFire
Copy link
Member

yiisoft/yii2-app-advanced@6251963

@cebe I think icon jump is better than icon that overlaps next column

@kidzen
Copy link

kidzen commented Jun 2, 2017

.grid-view td { white-space: nowrap; }
still happen in column.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants