从localStorage加载过滤器

时间:2018-07-30 14:59:39

标签: angular typescript primeng primeng-turbotable

我正在Primeng网站上使用Primeng表并像示例一样过滤数据

HTML

<p-dropdown [options]="serverQueues" appendTo="body" [style]="{'width':'100%'}" [(ngModel)]="userFilters.queueFilter" (onChange)="dt.reset();reset(col.field);dt.filter($event.value, col.field, 'equals');" ></p-dropdown>

dt.filter(正在执行此工作,并正在过滤表数据。

在触发(onChange)之后,将调用lazyLoad函数 然后在其中将过滤数据保存到localStorage

例如,当用户刷新网站时,加载这些过滤器的“正确”方法是什么。

在lazyLoad函数中有`event.filters 但它似乎是空的,没有数据。。我以为过滤器会在那里。

loadTasksLazy(event: LazyLoadEvent) {
    this.loading = true;
    //event.first = First row offset
    //event.rows = Number of rows per page
    //event.sortField = Field name to sort in single sort mode
    //event.sortOrder = Sort order as number, 1 for asc and -1 for dec in single sort mode
    //multiSortMeta: An array of SortMeta objects used in multiple columns sorting. Each SortMeta has field and order properties.
    //filters: Filters object having field as key and filter value, filter matchMode as value
    //globalFilter: Value of the global filter if available
    /////////////////////////
    let filters = event.filters;
    /////////////////////////

enter image description here

0 个答案:

没有答案