如何解决如何保存使用 angularjs 创建的表的排序顺序?
我使用 angularjs 创建了一个带有可排序列的表,代码如下(注意表中的数据是提交列表):
<p-table #tt [columns]="cols" [value]="shownSubmissions" [paginator]="true" [rows]="rowCount"
[resizableColumns]="true" [rowHover]="true" styleClass="primeng-custom">
<ng-template pTemplate="caption">
<div class="ui-helper-clearfix">
<span style="float:left;margin-top:2px;">Show
<p-dropdown [options]="entries" optionLabel="val" (onChange)="updateRowCount($event)" placeholder="50">
</p-dropdown>
entries</span>
<span style="float:right">
<i class="fa fa-search" style="margin:4px 4px 0 0"></i>
<input type="text" pInputText size="25" placeholder="Search"
(input)="tt.filterGlobal($event.target.value,'contains')" style="width:auto; display:inline-block;"
class="form-control">
</span>
</div>
</ng-template>
<ng-template pTemplate="header" let-columns>
<tr>
<th style="text-align:center;" [ngStyle]="{'width':col.width}" *ngFor="let col of columns"
[pSortableColumn]="col.field" pResizableColumn>
{{col.header}}
<p-sortIcon [field]="col.field"></p-sortIcon>
</th>
<th style="text-align:center">Action</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-sub let-columns="columns">
<tr>
<td *ngFor="let col of columns" style="overflow: hidden; word-wrap: break-word">
{{col.isDate ? (sub[col.field] | date:'MM/dd/yy') : sub[col.field]}}
</td>
<td>
<a class="block" [routerLink]="['/viewsubmission',sub.submissionId]">View</a>
<a class="block" *ngIf="sub.canEdit" [routerLink]="['/editsubmission',sub.submissionId]">Edit</a>
</td>
</tr>
</ng-template>
</p-table>
我希望能够对表格中的一列应用排序,移动到我网站的其他部分,然后在保留列排序的情况下返回表格。我该怎么做?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。