yii-dataview
yii-dataview copied to clipboard
GridView - can't set css class on tbody when empty rows
Render GridView widget with empty rows and table bootstrap class table table-hover
tbody (which contains $emptyText) changes it's background color on hover but I can't control that, because class empty is assigned to the div inside tbody
emptyTextOptions should be assigned to the tbody instead of div inside it

| Q | A |
|---|---|
| Yii version | 2.0.? |
| PHP version | 7.0 |
| Operating system | Windows |
@samdark https://github.com/yiisoft/yii2/blob/46b9d607a25769c8554773291698c4f6ec654187/framework/grid/GridView.php#L481-L485
we have BC broken
You can use any stronger CSS selector for overriding default styles. E.g. you may use
- outer wrapper's ID (
#js-tourists-table tbody tr), - attribute selector e.g.
table td[colspan=2], - pseudoselectors like
:first-child, tbody > tr:nth-of-type(odd) - combined tags & classes etc ...
Bootstrap is designed with low specificity to enable quite easy overriding. See how CSS power/priority/hierarchy/specifity is calculated
- https://stackoverflow.com/questions/4072365/css-understanding-the-selectors-priority-specificity
- https://www.w3.org/TR/css3-selectors/#specificity
Works alright in current master.
See https://github.com/yiisoft/yii-dataview/blob/master/src/GridView.php#L634