Comments (12)
@daniel-nagy Honestly, with some potential additional column types (such as menus, editable fields, etc). I think having something like column-type as an attribute would be a decent idea.
column-type="numeric"
etc...
from md-data-table.
@nathanmarks valid point.
from md-data-table.
I was sitting and trying to remove the selector column.
I found out that removing md-row-selected.... did the job
But under the process I realized that I cannot style the selector column
Because there is no way to identify the selectors TH / TD tags. Because they are generated.
I tried with styling ...
.no-selector td :first-child {
display: none;
}
and this will remove the "second" field because the generated TD is not "present" when the browser evaluates the first child.
So it would be nice to be able to put a class on the generated TH and TD elements.
from md-data-table.
"I was sitting and trying to remove the selector column. I found out that removing md-row-selected.... did the job"
Please read the documentation, it explains the purpose of each attribute.
/* to select the checkbox in the table header */
table[md-row-select] > thead > tr > th:first-child { ... }
/* to select all the checkboxes in the table body */
table[md-row-select] > tbody > tr > td:first-child { ... }
from md-data-table.
But that does not work 100% when I did it. The ng-repeat seems to interfere with what element is the first element
So the checkbox element + first "user-row" seems both to be selected..
from md-data-table.
I fixed my comment.
I am unable to reproduce the issue, please make a JSFiddle or Plunker clearly demonstrating the issue.
from md-data-table.
Super.
I will leave it here. If I see the problem in another situation I will be back.
I still think it would be relevant to be able to set a md-row-select-class - because the element is added "behind the scene" - and I find :first-child a little nerdy.
from md-data-table.
Hi,
It could be great to be able to disable some checkboxes too.
For example we could set a condition in which the checkbox is "selectable":
<tbody md-auto-select>
<tr ng-repeat="dessert in desserts.data" md-selectable="dessert.calories.value > 2">
<td>{{dessert.name}}</td>
<td>{{dessert.calories.value}}</td>
<td>{{dessert.fat.value}}</td>
<td>{{dessert.carbs.value}}</td>
<td>{{dessert.protein.value}}</td>
<td>{{dessert.sodium.value}}</td>
<td show-unit>{{dessert.calcium.value}}</td>
<td show-unit>{{dessert.iron.value}}</td>
</tr>
</tbody>
If the condition is not met the checkbox is disabled.
Thanks for your work.
from md-data-table.
@fanturi I've thought about this in the past and I like your idea. This shouldn't be too difficult to implement.
from md-data-table.
@fanturi this is now possible it version 0.7.0; it was a bit more difficult than I anticipated. :)
from md-data-table.
Hi @daniel-nagy,
It's great, thanks ! It's working like a charm :)
I just think it's weird to have put the attribute in the <tbody>
.
It means we use dessert
outside ng-repeat
, it's disturbing.
from md-data-table.
Haha, yeah it's a little strange. I put it there because there was more room on the <tbody>
element if you are using ngRepeat
to do pagination in the client.
There is something in the order of 7 different directives now within this module and quite a few of them need to be aware of your ng-repeat
expression. It is also worth noting that we couldn't simply put an ng-disabled
directive on the table row because anyone with half a brain could open the developer tools and remove the attribute. In addition, conditionally disabling rows required new logic for the master toggle in the table header, so I'm using the body element as sort of a communication medium between the table header and table rows.
from md-data-table.
Related Issues (20)
- Global setting
- How to select all rows? HOT 8
- Exclude certain rows from sorting
- Please bump version and publish to npm
- Custom cell disable using value - Md-data-table - AngularJS
- Sorting when using md-virtual-repeat and md-on-demand
- how can i have a fixed header when using md-vritual-repeat-conatiner
- Missing rows with mdVirtualRepeat
- Sticky column HOT 2
- Multiple parameter ordering HOT 1
- Refresh data table after edit, add, update.
- $mdEditDialog large throws an error while calling $http service on save.
- how to print md data table without order by arrow icon HOT 1
- Pagination localisation options are insufficient
- Live Demo has security breach (Kinda) HOT 3
- maintain sorting state in and out of session
- md-table-pagination not working for server side binding(other than page 1) HOT 1
- Selectable Columns Callback is not working
- Get limited data from server rather binding all data
- Bring md-select selected from server
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from md-data-table.