0

How can I access the index of each row in light-grid.

My code is here:

<tr lg-row-start>
    <td>
        <lg-view>
            {{ row.data.id }}<br />
            <input ng-click="selectRow(row.data, row.index)" name="lg-grid-select-row[]" value="{{row.data.id}}"
                 id="lg-grid-select-row{{row.data.id}}" class="lg-grid-select-row" type="checkbox" />
        </lg-view>
    </td>
</tr>

My light grid version is 0.3.1

Roham Rafii
  • 2,929
  • 7
  • 35
  • 49

1 Answers1

0

I changed the light-grid.js like this:

scope.row = {
    index: scope.$index, // I added this line
    data: scope.$$rowData,
    view: gridController.getInitialView() || DEFAULT_VIEW,
    viewModel: angular.copy(scope.$$rowData),
    controller: rowController
};
Roham Rafii
  • 2,929
  • 7
  • 35
  • 49