当我在表中编辑,删除或添加任何内容时,不刷新我的当前内容

时间:2019-02-15 15:03:42

标签: html asp.net angular asp.net-core bootstrap-table

我的页面上有两个单独的数据表。每次我添加,编辑或删除第二个表中的任何内容时,它永远不会显示更新的表或刷新表。但是第一个完美。当我调换职位时,我发现它始终适用于第一个职位。

我试图更改#ptable名称,但是没有任何作用。我逐行比较代码,但找不到任何代码。请帮帮我!

HTML:

<div class="row" style="padding-left:30px; padding-right:15px; margin-top:30px;">
                    <div class="mr-auto col-xs-6">
                        <h2>Financial Strategies</h2>
                    </div>
                    <div class="col-xs-6 text-right">
                        <button (click)="createFinancialStrategy(1, 'Financial Goal')" class="btn btn-primary blue"><i class="fa fa-plus"></i>Create Financial Goal</button>
                    </div>
                </div>
                <div class="row align-items-center db">
                    <!--<Primeng-Datatable-Start>-->
                    <div class="primeng-datatable-container"
                         [busyIf]="primengFinancialTableHelper.isLoading">
                        <p-table #dataTable
                                 (onLazyLoad)="getFinancialStrategies($event)"
                                 [value]="primengFinancialTableHelper.records"
                                 rows="{{primengFinancialTableHelper.defaultRecordsCountPerPage}}"
                                 [paginator]="false"
                                 [lazy]="true"
                                 [scrollable]="true"
                                 ScrollWidth="100%"
                                 [responsive]="primengFinancialTableHelper.isResponsive"
                                 [resizableColumns]="primengFinancialTableHelper.resizableColumns">
                            <ng-template pTemplate="header">
                                <tr>
                                    <th style="width: 150px" pSortableColumn="strategy.name">
                                        {{l('Name')}}
                                        <p-sortIcon field="strategy.name"></p-sortIcon>
                                    </th>
                                    <th style="width: 130px" [hidden]="!isGrantedAny('Pages.Strategies.Edit', 'Pages.Strategies.Delete')"></th>
                                </tr>
                            </ng-template>
                            <ng-template pTemplate="body" let-record="$implicit">
                                <tr>
                                    <td style="width:150px">
                                        <span class="ui-column-title"> {{l('Name')}}</span>
                                        {{record.strategy.name}}
                                    </td>
                                    <td style="width: 50px" align="right"
                                        [hidden]="!isGrantedAny('Pages.Strategies.Edit', 'Pages.Strategies.Delete')">
                                        <div class="btn-group dropdown" normalizePosition>
                                            <button class="dropdown-toggle btn btn-sm btn-primary"
                                                    data-toggle="dropdown"
                                                    aria-haspopup="true"
                                                    aria-expanded="false">
                                                <i class="fa fa-cog"></i>
                                            </button>
                                            <ul class="dropdown-menu">
                                                <li>
                                                    <a *ngIf="permission.isGranted('Pages.Strategies.Edit')"
                                                       (click)="createOrEditStrategyModal.show(record.strategy.id)">{{l('Edit')}}</a>
                                                </li>
                                                <li>
                                                    <a *ngIf="permission.isGranted('Pages.Strategies.Delete')"
                                                       (click)="deleteStrategy(record.strategy)">{{l('Delete')}}</a>
                                                </li>
                                            </ul>
                                        </div>
                                    </td>
                                </tr>
                            </ng-template>
                        </p-table>
                        <div class="primeng-no-data" *ngIf="primengFinancialTableHelper.totalRecordsCount == 0">
                            {{l('NoData')}}
                        </div>
                        <div class="primeng-paging-container" [hidden]="financialStrategies.length<=10">
                            <p-paginator rows="{{primengFinancialTableHelper.defaultRecordsCountPerPage}}"
                                         #paginator
                                         (onPageChange)="getFinancialStrategies($event)"
                                         [totalRecords]="primengFinancialTableHelper.totalRecordsCount"
                                         [rowsPerPageOptions]="primengFinancialTableHelper.predefinedRecordsCountPerPage">
                            </p-paginator>
                            <span class="total-records-count">
                                {{l('TotalRecordsCount', primengFinancialTableHelper.totalRecordsCount)}}
                            </span>
                        </div>
                    </div>
                    <!--<Primeng-Datatable-End>-->
                </div>

                <div class="row" style="margin-top:30px; padding-left:30px; padding-right:15px;">
                    <div class="mr-auto col-xs-6">
                        <h2>Non-Financial Strategies</h2>
                    </div>
                    <div class="col-xs-6 text-right">
                        <button (click)="createNonFinancialStrategy(2, 'Non-Financial Goal')" class="btn btn-primary blue"><i class="fa fa-plus"></i>Create Non-Financial Goal</button>
                    </div>
                </div>
                <div class="row align-items-center db">
                    <!--<Primeng-Datatable-Start>-->
                    <div class="primeng-datatable-container"
                         [busyIf]="primengNonFinancialTableHelper.isLoading">
                        <p-table #dataTable
                                 (onLazyLoad)="getNonFinancialStrategies($event)"
                                 [value]="primengNonFinancialTableHelper.records"
                                 rows="{{primengNonFinancialTableHelper.defaultRecordsCountPerPage}}"
                                 [paginator]="false"
                                 [lazy]="true"
                                 [scrollable]="true"
                                 ScrollWidth="100%"
                                 [responsive]="primengNonFinancialTableHelper.isResponsive"
                                 [resizableColumns]="primengNonFinancialTableHelper.resizableColumns">
                            <ng-template pTemplate="header">
                                <tr>
                                    <th style="width: 150px" pSortableColumn="strategy.name">
                                        {{l('Name')}}
                                        <p-sortIcon field="strategy.name"></p-sortIcon>
                                    </th>
                                    <th style="width: 130px" [hidden]="!isGrantedAny('Pages.Strategies.Edit', 'Pages.Strategies.Delete')"></th>
                                </tr>
                            </ng-template>
                            <ng-template pTemplate="body" let-record="$implicit">
                                <tr>
                                    <td style="width:150px">
                                        <span class="ui-column-title"> {{l('Name')}}</span>
                                        {{record.strategy.name}}
                                    </td>
                                    <td style="width: 50px" align="right"
                                        [hidden]="!isGrantedAny('Pages.Strategies.Edit', 'Pages.Strategies.Delete')">
                                        <div class="btn-group dropdown" normalizePosition>
                                            <button class="dropdown-toggle btn btn-sm btn-primary"
                                                    data-toggle="dropdown"
                                                    aria-haspopup="true"
                                                    aria-expanded="false">
                                                <i class="fa fa-cog"></i>
                                            </button>
                                            <ul class="dropdown-menu">
                                                <li>
                                                    <a *ngIf="permission.isGranted('Pages.Strategies.Edit')"
                                                       (click)="createOrEditStrategyModal.show(record.strategy.id)">{{l('Edit')}}</a>
                                                </li>
                                                <li>
                                                    <a *ngIf="permission.isGranted('Pages.Strategies.Delete')"
                                                       (click)="deleteStrategy(record.strategy)">{{l('Delete')}}</a>
                                                </li>
                                            </ul>
                                        </div>
                                    </td>
                                </tr>
                            </ng-template>
                        </p-table>

                        <div class="primeng-paging-container" [hidden]="nonFinancialStrategies.length<=10">
                            <p-paginator rows="{{primengNonFinancialTableHelper.defaultRecordsCountPerPage}}"
                                         #paginator
                                         (onPageChange)="getNonFinancialStrategies($event)"
                                         [totalRecords]="primengNonFinancialTableHelper.totalRecordsCount"
                                         [rowsPerPageOptions]="primengNonFinancialTableHelper.predefinedRecordsCountPerPage">
                            </p-paginator>
                            <span class="total-records-count">
                                {{l('TotalRecordsCount', primengNonFinancialTableHelper.totalRecordsCount)}}
                            </span>
                        </div>
                    </div>
                    <!--<Primeng-Datatable-End>-->
 </div>

我也想刷新第二张桌子。

0 个答案:

没有答案