This is a migrated thread and some comments may be shown as answers.

KendoUi format broken after require.js optimize

2 Answers 45 Views
Globalization
This is a migrated thread and some comments may be shown as answers.
Sascha
Top achievements
Rank 1
Sascha asked on 09 Jul 2014, 10:31 AM
Hi all,

I have a Backbone application with multiple KendoUi [v2013.2.918; kendo.all.min.js] components e.g. Grid, NumericTextBox. To display this value "12,5 h" in a numericTextBox, I use this:

this.$('.kendoHourInput').kendoNumericTextBox({
  format: '#.0 h'
});

For the development Version, not optimized with r.js (requie.js), everything works as expected. For the production Version, after the r.js optimizer, this format breaks the app:

Uncaught TypeError: Cannot read property 'numberFormat' of null

The predefined formats like "c2" or "p" works without a problem. Could it be a problem with the kendo.culture('de-DE') I use? I had similar problems with the library globalize.js, which overrides the kendo.culture. Is there a known dependency to another library who could break the optimized-code? There is a 2nd library with dependencies to globalize.js:

require.js-config
shim: {
    ...
    someLib: {
        deps: ['globalize']
    }
}

There is a forum entry on the kendo site, with a similar problem. The solution should be to load the kendo library before the globalize library. If I take a look to the script-tags on the index.html, kendo comes before globalize. So, this is not a solution that works for me.

For more information, please let me know.

Thanks 

Sascha

2 Answers, 1 is accepted

Sort by
0
Accepted
Georgi Krustev
Telerik team
answered on 11 Jul 2014, 06:58 AM
Hello Sascha,

Based on the given error message, I would conclude that a newer version of Globalize.js is used (2.x version), where the API signature has changed drastically. Because of this change we decided to cease our support for Globalize.js 2.x or higher. You can find a related discussion here. The feasible solution for now is to load the Globalize script after kendo.all.js.

Regards,
Georgi Krustev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Sascha
Top achievements
Rank 1
answered on 11 Jul 2014, 10:22 AM
Hey Georgi,

the newer version of globalize.js did it. By the way, the latest version of globalize.js is 1.0.0-alpha.3.
Unhappily, the "someLib" doesn't works with the newer version of globalize.js, but this is another problem :-)

Best regards,

Sascha

Tags
Globalization
Asked by
Sascha
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Sascha
Top achievements
Rank 1
Share this question
or