代码之家  ›  专栏  ›  技术社区  ›  Naomi

angularjs行内重复表行

  •  0
  • Naomi  · 技术社区  · 6 年前

    我已经阅读了一些关于这个话题的线索,我认为我很接近,但我可能需要一点帮助。我试图显示采购订单的行项目如果line items数组中的row发明了=0,我想将所有关于它的信息显示为一行但是,如果发明了>0,则我希望在“header”行和其他列中显示itemId、昵称和说明,作为与跟踪行类似的普通行这是我当前的代码,最后在每个“矩阵”行上方重复“标题”行。

    <table id="lineItemsTable"
           class="table table-bordered table-hover table-list scTable">
        <thead>
            <tr>
                <th>@Labels.itemId</th>
                <th>@Labels.nickname</th>
                <th>@Labels.description</th>
                <th>@Labels.ordered</th>
                <th>@Labels.cost</th>
                <th>@Labels.extension</th>
                <th>@Labels.price</th>
                <th>@Labels.margin</th>
                <th>@Labels.receiveLocation</th>
                <th>@Labels.received</th>
                <th>@Labels.remaining</th>
                <th>@Labels.vendorPartNo</th>
                <th>@Labels.upc</th>
            </tr>
        </thead>
        <tbody>
            <tr ng-repeat-start="result in crud.model.lineItems track by $index"
                ng-click="crud.selectedIndex=$index;"
                ng-class="{selected: $index === crud.selectedIndex}">
                <td>{{result.itemId}}</td>
                <td>{{result.item}}</td>
                <td>{{result.itemDescrip}}</td>
            </tr>
            <tr ng-repeat-end ng-if="result.inventId!==0">
                <td></td><td></td><td>{{result.inventoryDescrip}}</td>
            </tr>
        </tbody>
    </table>
    

    我附加了一个屏幕截图,显示了我希望使用一系列行项目实现的目标:

    enter image description here

    1 回复  |  直到 6 年前
        1
  •  0
  •   Naomi    6 年前

    把我的问题写下来总是有帮助的我一贴出来,就想到了解决办法我将把rowNumber列添加到返回行项目的存储过程中,并且仅当Rn=1时才显示该信息。

    我让它工作,虽然我不能使原来的奇偶行背景色现在所有的“header”行看起来都是偶数,这可能是一个不错的效果。