jquery bootgrid使用Last Column Repeated中的值进行渲染

时间:2015-03-02 09:56:17

标签: javascript jquery user-interface

我有简单的表,我绑定了这个jquery引导网格。但是Cloumn中的最后一个值会反映到该行中的所有列。如果我取消绑定make网格,这恰好就会发生。

下面附有相同的代码。任何建议都会有所帮助。

     @Section Scripts
     <script src="~/Scripts/jquery.bootgrid.js"></script>
<script>

      $(document).ready(function () {
        $("table.make-bootgrid").bootgrid();
    });
</script>
        End Section


 <div class="panel panel-primary">
<div class="panel-heading">
   <h3 class="panel-title">
        All Requests for Service
    </h3>
</div>
<div class="table-responsive">
    <table class="table table-striped table-hover make-bootgrid">
        <thead>
            <tr>
                <th>

                </th>
                <th>
                    Car Registeration
                </th>
                <th>
                    Services In Request
                </th>
                <th>
                    Services In Request Count
                </th>
                <th>
                    Quotes Count
                </th>
                <th>
                    Created
                </th>

            </tr>
        </thead>
        <tbody>
            @For Each item In Model
                Dim itemValue = item
                @<tr>
                    <td>
                        @Html.ActionLink("View", "Details", "Requests", New With {.id = itemValue.ID}, Nothing)
                    </td>
                    <td>
                        @Html.DisplayFor(Function(modelItem) itemValue.Registration)
                    </td>
                    <td>
                        @For Each sir As ServicesInRequest In itemValue.ServicesInRequests
                            @<li>@sir.Service.Name</li>
                        Next
                    </td>
                    <td>
                        @Html.DisplayFor(Function(modelItem) itemValue.ServicesInRequests.Count)
                    </td>
                    <td>
                        @Html.DisplayFor(Function(modelItem) itemValue.Quotes.Count)
                    </td>
                    <td>
                        @Html.DisplayFor(Function(modelItem) itemValue.Created)
                    </td>
                </tr>
            Next
        </tbody>
    </table>
</div>

1 个答案:

答案 0 :(得分:4)

我遇到了同样的问题。修正了:

  • 确保将一列指定为:data-identifier =“true”
  • 确保所有列都具有数据ID属性:data-column-id =“GroupID”

请参阅下面我工作表中的摘录:

    <thead>
        <tr class="active">
            <th data-column-id="GroupID" data-identifier="true" data-type="numeric">ID</th>
            <th data-column-id="GroupName" data-order="asc">Name</th>
            <th data-column-id="GroupDesc">Description</th>
        </tr>
    </thead>