getLocaleSettings js error in core.js

jQuery UI Widgets
Post Reply
Bk1ng
Posts: 4
Joined: 16 Dec 2015, 23:34

22 Jun 2016, 20:22

I was in the process of upgrading from 5.3 to 6.0 today and I noticed that I get 'Cannot read property 'split' of undefined' javascript error whenever the page loads.

I noticed that the getLocaleSettings function in the core.js is new to Primefaces 6.0. In the following snippet b.settings.locale is empty, then it fails on the c.split

Code: Select all

      getLocaleSettings: function() {
            if (!this.localeSettings) {
                var c = b.settings.locale;
                this.localeSettings = b.locales[c];
                if (!this.localeSettings) {
                    this.localeSettings = b.locales[c.split("_")[0]];
                    if (!this.localeSettings) {
                        this.localeSettings = b.locales.en_US
                    }
                }
            }
            return this.localeSettings
I noticed this seems to happen when I add a dataTable to the page, when I remove it the js error goes away. The data table is completely empty too

Code: Select all

<p:dataTable />
Is there a config element or something different from 5.3 that I'm missing? Any help is much appreciated!

Illuzionn
Posts: 2
Joined: 10 Jun 2014, 12:10

05 Dec 2016, 15:15

Hi,

I have the same error while upgrading from PF 5.1 to 6.0
Some pages containing <p:datatable> just work fine, but some other don't. I get the Javascript error mentionned in the precedent post.
Uncaught TypeError: Cannot read property 'split' of undefined
Deleting the datatable from the page makes the error disappear.
Even just including "<p:datatable />" inside the page makes the error systematically pop while displaying the page.

Any ideas ? Did you manage to solve the problem ?
Thanks a lot :)

Illuzionn
Posts: 2
Joined: 10 Jun 2014, 12:10

06 Dec 2016, 10:07

Ok, I solved the problem by including this small script inside my template page :

Code: Select all

PrimeFaces.settings.locale = 'fr_FR';
Don't know if this is the right way to do it, but I couldn't find any other information about this problem.
Is this fix ok ?

Thanks

Post Reply

Return to “PrimeUI”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 6 guests