Я застрял на этой части на несколько дней.
У меня есть массив, в котором есть объект, у объекта есть значения GenericID и IsSubsector, есть ли возможность, когда GenericID равен 0, а IsSubSector равен false, это будет родительская строка для GenericID со значением и IsSubSector истина. Я знаю, что это может быть сделано в JavaScript. Есть ли другой способ, которым я могу сделать это один в html с angularjs.
<div class="container-fluid grid-padded">
<table ng-table="roboticEditTable" class="table table-responsive table-condensed" style="width: 99.9% !important" show-filter="true">
<tbody ng-repeat="row in $data">
<tr id="row.Id" ng-click="changeSelection(row, $index)" ng-class=" { 'active': row.$selected } ">
<td title="RoboticEditTitle" class="text-center">
<div ng-show="editIndex!==$index">
<button ng-show="row.SectorDescription === 'None'" type="button" class="btn btn-xs btn-default clickable" data-toggle="collapse" data-target="#{{ $index }}" uib-tooltip-placement="top" ng-disabled="performingAction" uib-tooltip-append-to-body="true" uib-tooltip="<%= GlobalizationUtil.GetText(GlobalizationKey.Show) %>">
<i class="fa fa-toggle-down"></i>
</button>
</div>
</td>
<td title="labels.sector" filter="{'SectorCode': 'text'}" sortable="'SectorDescription'">{{ row.SectorCode + ' - ' }} {{ row.SectorDescription }} </td>
<td title="labels.glAccount" filter="{'AccountCode': 'text'}" sortable="'AccountCode'">{{ row.AccountCode + ' - ' }} {{ row.RGSCode + ' - ' }} {{ row.AccountDescription | ellipsis }}</td>
<td title="labels.articleCode">{{ row.ArticleCode }}</td>
<td title="labels.description">{{ row.Description }}</td>
<td title="labels.percentage">{{ row.VatPercent | percentage }}</td>
</tr>
<tr data-parent="row.GenericID" >
<td class="col-sm-2"></td>
<td class="col-sm-2" filter="{ 'row.SectorDescription': 'text' }" style="padding-left:35px;">
<i class="fa fa-plus" style="padding-right: 10px;"></i>
{{ row.SectorCode + ' - '}} {{ row.SectorDescription }}
</td>
<td>{{ row.AccountCode + ' - ' }} {{ row.RGSCode + ' - ' }} {{ row.AccountDescription | ellipsis }}</td>
<td>{{ row.ArticleCode }}</td>
<td>{{ row.Description }}</td>
<td>{{ row.VatPercent | percentage }}</td>
</tr>
</tbody>
</table>
</div>
Я использую data-parent на данный момент, но идентификатор или индекс не распознают его. Идентификатор родительского элемента - это строка. Идентификатор дочернего элемента - это GenericID
ID another column IsSubSector GenericID
71 data.. data.. 0 NULL
91 data.. data.. 1 71
100 data.. data.. 1 71