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

Not able to use ngRepeat to generate table <td>s #32

Open
Parthvora opened this issue Jan 27, 2016 · 2 comments
Open

Not able to use ngRepeat to generate table <td>s #32

Parthvora opened this issue Jan 27, 2016 · 2 comments

Comments

@Parthvora
Copy link

Hello,

Can anyone please help me to generate the dynamic < td >s in the table?
Not working:
< tbody>
< tr>
< td ng-repeat="col in columns">
{{ col }}
< /td>
< /tr>
< /tbody>

However, ngRepeat for other tags is working:
< tbody>
< tr>
< td>
< p ng-repeat="col in columns">
{{ col }}
< /p>
< /td>
< /tr>
< /tbody>

@ekokotov
Copy link
Owner

It's possible.

  1. add ng-non-bindable attribute to your tbody
    see here. It will prevent to compile ng-repeat by angular before directive will be compiled.
  2. if columns is a property of controller scope - it should be $owner.columns.

@Parthvora
Copy link
Author

Thanks a lot man, it worked for < td>s
But I'm facing issues while generating < th>s using ngRepeat. I'm able to generate the < th>s dynamically using ngRepeat, but the issue is with column drag.

When I'm trying to drag a column I'm getting:
TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'.

Here is my code:
HTML:
< table object-table data="users" headers="Fname,Lname,Phone,Email" fields="columns"
sorting="no" paging="no" search="no" display="recPerPage">
< thead>
< tr>
< th ng-repeat="col in $owner.columns" allow-drag>
{{ col.title }}
< /th>
< /tr>
< /thead>
< tbody ng-non-bindable>
< tr>
< td ng-repeat="col in $owner.columns">
{{ ::item[col.field] }}
< /td>
< /tr>
< /tbody>
< /table>

I have tried "ng-non-bindable" on < thead> as well as on < th> of table header, but not useful here.

So, anyway I can generate dynamic < th>s with ngRepeat and which are also draggable?

Thanks

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

No branches or pull requests

2 participants