3

I mean <p:dataTable> with defined filter. I'd like that when it'll finish loading and rendering the values in it will be filtered.

Thank you.

UPDATE:

I've used this code

<p:remoteCommand name="onload" oncomplete="PF('ticketTable').filter()" autoRun="true"/>

from this question: PrimeFaces. Update DataTable after Rendering, it updates table after loading but there's a significant gab after table has been rendered and updated. I'd try to decrease it by setting `filterDelay="1" but without significant changes. Maybe somebody have another ideas?

UPDATE 2

All solutions where filter invoked onLoad or onReady not good because table is rendered filled with values and then filtered and it creates bad user experience. I'm looking for solution where table will be rendered with filtered values. Almost sure to achieve this I need to overwrite renderer.

Community
  • 1
  • 1
Anatoly
  • 5,056
  • 9
  • 62
  • 136
  • possible duplicate of [setting default value in primefaces datatable Filter](http://stackoverflow.com/questions/15450274/setting-default-value-in-primefaces-datatable-filter) – kolossus Apr 30 '15 at 13:54
  • no, it isn't duplicate. I implemented very simple solution and it doesn't look good. When table rendered at the beginning it filled with all records, after onReady invoked it shrinks itself to filtered values. I want that table will be rendered with filtered values. – Anatoly Apr 30 '15 at 13:59
  • No, implemented your solution and it doesn't work as need – Anatoly Apr 30 '15 at 14:18
  • 1
    Are you using `LazyDataModel`? If so, you should be able to just preset defaults if `filters` argument is empty. – BalusC Apr 30 '15 at 14:31
  • @BalusC, currently no but I thought about `LazyDataModel` as possibility. Most likely that I will do so, it looks as the best and perhaps single option to solve this issue without crazy workarounds. – Anatoly Apr 30 '15 at 14:58
  • For each key pressed in filter field, would you like to change too? And remove the filter, load the base data if I understand correctly. interesting request, intrigued – serifsadi May 01 '15 at 20:47
  • It wont be a filter field but button, archived/active, etc... or dropdown list with values archived/active. I'd like that it will rendered with `archived` value selected. – Anatoly May 01 '15 at 20:50
  • Where to be selected this archived value. Other page, set by user, set by authorization... – serifsadi May 01 '15 at 20:56
  • It's going to be list of objects, every object will have property `archived`. I can't get rid of this objects and need to load them but not to show to end user. Admin's will be able to see archived objects, regular user don't even need to know that they exist. Anyway, I'm going to implement `LazyDataModel` as @BalusC mentioned. – Anatoly May 02 '15 at 07:11

0 Answers0