Ngx-datatable: Table not working correctly with material design's md-checkbox

Created on 1 Dec 2016  Â·  5Comments  Â·  Source: swimlane/ngx-datatable

Bug, feature request, or proposal:

Bug

What is the expected behavior?

When using native checkboxes with Angular2-Data-Table, I can toggle columns on or off the table.

When trying to implement Angular2 Material Design's md-checkbox the first click doesn't work - the checkbox remains checked.

After the first click the checked value is opposite to the model, i.e. opposite to the native checkboxes.

I tried many ways to fix this but without luck. I don't know whether this is a bug in md-checkbox or in angular2-data-table.

In the plunker the code from the demo, and added md-checkboxes in addition to the native ones:
https://plnkr.co/edit/HGUjy5

What is the current behavior?

The first click should toggle the checkbox correctly.

What is the use-case or motivation for changing an existing behavior?

it would be great to use md-checkbox with the datatable

Which versions of Angular, Material, OS, browsers are affected?

latest Angular (2.1.2)
latest Angular 2 Material
latest angular2-data-table

Bug Investigate

All 5 comments

I'm not sure what your code looks like (is there a way to view it from that plunk link?). However, I had this problem when using md-checkbox. The solution was to bind to the change event instead of the click event that you would typically use on a native checkbox.

<md-checkbox (change)="changed()"></md-checkbox>

@dsbert thank you the workaround worked !
but it's still a bug, so I'm leaving the issue open.
you can see the code here: https://plnkr.co/edit/HGUjy5

Sounds good.

side note: I just released a new version with checkbox selection built in, which might be what you were trying to do.

hi,
thanks for the info.
any idea on how I can change the select checkbox to angular material's
?

also, there's a bug when 'rows' attribute is initialized in the
constructor, "cant read property length of undefined" in index.js:2154
(this.rows is undefined) but i will open a separate issue on that.

On Sat, Dec 3, 2016 at 7:00 PM, Austin notifications@github.com wrote:

Sounds good.

side note: I just released a new version with checkbox selection built in,
which might be what you were trying to do.

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/swimlane/angular2-data-table/issues/333#issuecomment-264651244,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AFyCRnV2e36miWRpYJAWbLa92tu6WRBrks5rEaAygaJpZM4LBipc
.

--
►►Rotem Meiri
[email protected]
facebook.com/rotemx

Plz open a ticket for that.

If you wanted to use material checkbox, just use it like you want any other custom control and handle selection yourself.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

eddy-geek picture eddy-geek  Â·  3Comments

alceucardoso picture alceucardoso  Â·  3Comments

rotemx picture rotemx  Â·  3Comments

Matthi0uw picture Matthi0uw  Â·  3Comments

ExTheSea picture ExTheSea  Â·  3Comments