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

grid not getting kendo.culture messages

3 Answers 562 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Rick
Top achievements
Rank 2
Rick asked on 06 Jan 2016, 05:51 PM

This is not urgent enough to be a ticket.

I am setting the culture for each user at login. At least the datePickers get the culture as I can see the dates formatted with it.

But, the grids do not have the messages. The globalization overview says all widgets that support date or numeric formatting also depend on current culture. These widgets are the more complex ones like Grid, ListView, Charts and etc.

Am I missing something?

Thanks,

Rick

<!DOCTYPE html>
<html style="height:100%;width:100%;">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Menlo Park Project</title>
    <link rel="stylesheet" href="../styles/kendo.common.min.css">
    <link rel="stylesheet" href="../styles/kendo.default.min.css">
    <style type="text/css">
        .k-grid tr { max-height:1.5em !important; overflow:hidden !important; }
        .k-grid td { max-height:1.5em !important; overflow:hidden !important; }
        .k-grid-header th.k-header { padding-bottom:0.2em !important; padding-top:0.2em !important; }
        .k-tabstrip .k-content { padding-left:0.3em !important; padding-right:0.3em !important; }
        .k-button { line-height:1.25em !important; }
        .my-data-columns   li { display: block; float: left; text-align: right; height: 22px; line-height:1.25em; }
        .options-2-columns li { display: block; float: left; width: 50%; height: 22px; line-height:1.25em; }
        .options-3-columns li { display: block; float: left; width: 33%; height: 22px; line-height:1.25em; }
        .options-4-columns li { display: block; float: left; width: 25%; height: 22px; line-height:1.25em; }
        .k-window, .k-window-content.k-content{ background-color: rgba(255,255,255,0.01); }
    </style>
    <script src="../js/jquery-1.9.1.js"></script>
    <script src="../js/kendo/kendo.all.min.js"></script>
    <script src="../js/cultures/kendo.culture.en-US.min.js"></script>
    <script src="../js/cultures/kendo.culture.fr-FR.min.js"></script>
    <script src="../js/cultures/kendo.culture.de-DE.min.js"></script>
    <script src="../js/cultures/kendo.culture.it-IT.min.js"></script>
    <script src="../js/cultures/kendo.culture.es-ES.min.js"></script>
</head>

var loginButton = loginWindow.element.find("#LoginButton").kendoButton({
    click: function(e) {
        viewModel.dataSource.filter( { field: "TeamMemberEmail", operator: "eq", value: email });
        viewModel.dataSource.fetch( function (e) {
            var view = viewModel.dataSource.view();
            if (view.length == 1) {
                window.LoggedIn.TeamMember = view[0];
                kendo.culture(window.LoggedIn.TeamMember.LocaleKey);
                createApplicationWindow();
                loginWindow.destroy();
            } else {
                alert(" Email/Password combination not found. Is your CAPS LOCK key on?")
            }
        });
    
}).data("kendoButton");

3 Answers, 1 is accepted

Sort by
0
Rick
Top achievements
Rank 2
answered on 07 Jan 2016, 01:07 PM

I think I have a solution: jQuery.getScript()

I know if I run a kendo.messages file it will update all the grid messages.

It will very easy for me to run it asynchronously as part of login when I have the user's culture.

When I get around to it.

Rick

0
Accepted
Alexander Valchev
Telerik team
answered on 08 Jan 2016, 12:02 PM
Hello Rick,

The jQuery.getScript() solution is good one. The same approach is used in the localization demo of the Grid widget.

Regards,
Alexander Valchev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Rick
Top achievements
Rank 2
answered on 10 Jan 2016, 09:35 PM

I got the getScript solution working:

viewModel.dataSource.fetch( function (e) {
    var view = viewModel.dataSource.view();     console.error("LoginWindow view", view);
    if (view.length == 1) {
        window.LoggedIn.TeamMember = view[0];
        kendo.culture(window.LoggedIn.TeamMember.LocaleKey);
        var url = "../js/messages/kendo.messages." + window.LoggedIn.TeamMember.LocaleKey + ".min.js";
        $.getScript( url, function( data, textStatus, jqxhr ) { // use kendo CDN version in production
            createApplicationWindow();
            loginWindow.destroy();
        });
    } else {
        alert(" Email/Password combination not found. Is your CAPS LOCK key on?")
    }
}  

Thanks for the support.

Rick

Tags
Grid
Asked by
Rick
Top achievements
Rank 2
Answers by
Rick
Top achievements
Rank 2
Alexander Valchev
Telerik team
Share this question
or