Help needed for Datatable header Date Range Filter upgrade from version 7 to 11

UI Components for JSF
Post Reply
webforyou
Posts: 1
Joined: 17 Feb 2017, 13:50

24 Jun 2022, 11:04

We had this working piece of code from PF 7

Code: Select all


<p:calendar id="from" pattern="dd.MM.yyyy" inputStyle="width: 80px;">
                                            <p:ajax event="dateSelect"
                                                    onstart="$(PrimeFaces.escapeClientId('#{p:component('filter')}'))[0].value = $(PrimeFaces.escapeClientId('#{p:component('from')}_input'))[0].value + '-' + $(PrimeFaces.escapeClientId('#{p:component('to')}_input'))[0].value"
                                                    oncomplete="PF('ordersTable').filter()"/>
                                        </p:calendar>
                                        
<p:calendar id="to" pattern="dd.MM.yyyy" inputStyle="width: 80px;">
                                            <p:ajax event="dateSelect"
                                                    onstart="$(PrimeFaces.escapeClientId('#{p:component('filter')}'))[0].value = $(PrimeFaces.escapeClientId('#{p:component('from')}_input'))[0].value + '-' + $(PrimeFaces.escapeClientId('#{p:component('to')}_input'))[0].value"
                                                    oncomplete="PF('ordersTable').filter()"/>
                                        </p:calendar>

And now since we are upgrading to PF V11, the p:component is no longer working according to the migration guide:
Facelet function p:component has been removed in favor of: p:resolveFirstComponentWithId('myId', view).clientId
Can any one tell me how can I rewrite the previous code with the new "p:resolveFirstComponentWithId('myId', view).clientId"

Primefaces 11.0.5 and JSF 2.3.9

Melloware
Posts: 3717
Joined: 22 Apr 2013, 15:48

27 Jun 2022, 14:18

Did you try...

Code: Select all

$(PrimeFaces.escapeClientId('#{p:resolveFirstComponentWithId('filter', view).clientId}'))

PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 28 guests