mdDataTable
mdDataTable copied to clipboard
How to add class or ng-class attributes to mdt-cell or mdt-column
Hi there,
I would like to know how to add class or ng-class attributes to mdt-cell or mdt-column. I have tried the below but the resulting <td>
does not get the class. Is it intentional? I need this feature.
<mdt-cell ng-show="currLinkObj.hasEdit && currView == 'edit'" class="icon-edit" html-content="true"> <a ng-href="{{ hrefEdit | raw }}"> <div class="text-center"> <md-icon class="md-primary" md-svg-src="img/icons/actBtns/links/edit.svg"></md-icon> </div> </a> </mdt-cell>
Thanks.
Hi @faheemhameed , thanks for your question.
It is not possible at the moment, but what you can do is to have your own content for your cells.
Everything inside mdt-cell
should be visible in the generated content. Try to apply your needed classes on your embedded html contents, not on the mdt-cell
directive.
Is that a good solution for you?
Hi @iamisti, thanks for your reply.
What I wanted to do is give a width for the cells manually. So I think I have set the css width to the mdt-cell or mdt-column.
any other way we can do this? For now how about inline style. Will it work?
will not work neither. mdt-column
is just collecting data, then it's a separate step when the table get's generetad with table, td, th, tr elements.
But you can set anytime a column with of a table by using :nth-child pseudo.
table td:nth-child(2) {
width: 200px;
}
But anyway, I'll think to add a possibility to add classes to a column. It would actually make sense.
That's a trick. Thanks!
But yes, please have the possibility to add classes to mdt-cell and mdt-column
.
having same issue. @iamisti sir any updates on adding custom class?