tympanix / angular-table-resize

An AngularJS module for resizing table columns!

Home Page:https://tympanix.github.io/angular-table-resize/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Usage with table generated using ng-repeat

sholybonoly opened this issue · comments

Nice library very useful - thanks!

However it would be great if handled changes to the table. I have a table that uses ng-repeat to generate its columns so they will change on updates to my model and I want to the table resizer to update when this happens accordingly.

It could maybe do this by observing changes to number of headers in resizeable directive?

function watchTableChanges(table, attr, scope) {
        scope.$watch(
            function () { return $(table).find('th').length; },
            function () {
                cleanUpAll(table);
                initialiseAll(table, attr, scope);
            });
  }

Was this your thinking behind "bind" scope attribute. I don't think this is doing anything at present.

Funny you should mention this. I have been working on this feature for the past few weeks in the v2.0 branch. Your intuition in your code snippet seems correct and in fact I've done something similar in the next release. Unfortunately it brings a whole new deal of problems which I have to address before I feel comfortable releasing. You are more than welcome to check out the v2.0 branch :)

Still can't resize with ng-repeat!
I can't find a way to make it works with ng-repeat. Can you tell me what I did wrong please?

<thead>
    <th ng-repeat="item in items" id="{{ $index }}" rz-col="{{'col' + $index }}"></th>
</thead>

<tbody>
    <tr ng-repeat="item in items">
        <td>{{item}}</td>
        <td>Approved</td>
        <td>Even more none</td>
        <td>Black hole</td>
    </tr>
</tbody>

The table shows correctly as expected.

ng-repeat="item in items" id="0" rz-col="col0" class="ng-scope"

But it cant be resized. I know it should have a tag like this inside
class="rz-handle"

Please help! Thankx

Have you read the dynamic tables section in the readme? You are using ng-repeat on your items twice, I don't think that's intended. You should have an ng-repeat for your columns and one for your items. Also, like stated in the readme, your table headers (<th>) must not have an id, only rz-col.

N.B. you should use ng-attr-id anyway when interpolating ids from expressions