TypeError: PF(...) is undefined

UI Components for JSF
Post Reply
eduarddrenth
Posts: 21
Joined: 07 Mar 2018, 16:39
Contact:

12 Jun 2018, 07:42

After upgrading primefaces from 6.1.17 to 6.2.5 (or 6.2.4) my application fails with the above error. No other errors, no other changes

What can be the problem?

Regards, Eduard

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

12 Jun 2018, 10:35

1000% sure there is not a left-over older PrimeFaces jar in the runtime version of the project?

https://www.google.com/search?q=primefa ... +undefined

eduarddrenth
Posts: 21
Joined: 07 Mar 2018, 16:39
Contact:

12 Jun 2018, 12:41

Yes, only primefaces-6.2.5.jar is in the war, also undeployed everything else....using ff 60 ubuntu 1604

eduarddrenth
Posts: 21
Joined: 07 Mar 2018, 16:39
Contact:

12 Jun 2018, 12:46

chromium gives me a perhaps better error:

Uncaught TypeError: Cannot read property 'filter' of undefined. Points to the last breaking change in the migration guide?

eduarddrenth
Posts: 21
Joined: 07 Mar 2018, 16:39
Contact:

12 Jun 2018, 12:56

Added value="#{null}", does not help

log from chromium:

Code: Select all

(index):7 Uncaught TypeError: Cannot read property 'filter' of undefined
    at Object.onco ((index):7)
    at Object.<anonymous> (core.js?ln=primefaces&v=6.2.5:3)
    at i (jquery.js?ln=primefaces&v=6.2.5:2)
    at Object.fireWith [as resolveWith] (jquery.js?ln=primefaces&v=6.2.5:2)
    at A (jquery.js?ln=primefaces&v=6.2.5:4)
    at XMLHttpRequest.<anonymous> (jquery.js?ln=primefaces&v=6.2.5:4)
perhaps has to do with custom filtering, I do this:

Code: Select all

                        <p:column sortBy="#{item.foarm}" filterBy="#{item.foarm}" filterValue="#{lazyLemma.filters['foarm']}">
                            <f:facet name="filter">
                                <p:keyboard showMode="button" layoutTemplate="#{lemmaController.diacriticsKeyBoard()}" onkeyup="PF('datalist').filter();" 
                                             value="#{lazyLemma.filters['foarm']}"/>
                            </f:facet>

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

13 Jun 2018, 15:58

Can you post a mcve (http://stackoverflow.com/help/mcve) hard for me to investigate without one.

eduarddrenth
Posts: 21
Joined: 07 Mar 2018, 16:39
Contact:

14 Jun 2018, 16:25

I'll see what I can do, it'll take some time

eduarddrenth
Posts: 21
Joined: 07 Mar 2018, 16:39
Contact:

15 Jun 2018, 11:38

The problem is solved when I give this remote command a delay of 200 (I know not realy nice):

Code: Select all

                <p:remoteCommand delay="200" autoRun="true" oncomplete="PF('datalist').filter();"/>
the remote command is defined before the 'datalist' widget in the xhtml.

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

15 Jun 2018, 18:32

Try putting it AFTER the datalist then...

eduarddrenth
Posts: 21
Joined: 07 Mar 2018, 16:39
Contact:

24 Jun 2018, 08:12

yes that works, I changed my whole approach and put this at the end of my template (chose this because remoteCommand must be in a form and all I want is run some js):

Code: Select all

            <c:if test="#{param['state'] == 'filtering'}">
                <script>
                    $(document).ready(function() {
                        PF('datalist').filter();
                    });
                </script>
            </c:if>
issue can be closed.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 44 guests