We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to set the format and language in Spanish to a date in a childGrid?

Thread ID:

Created:

Updated:

Platform:

Replies:

149333 Nov 22,2019 12:53 AM UTC Nov 26,2019 07:04 AM UTC ASP.NET MVC - EJ 2 5
loading
Tags: Grid
Juan Cruz
Asked On November 22, 2019 12:53 AM UTC

Hi, I am setting up a grid with a childGrid and when I try to format a date it always puts the full format as Friday, November 4, 2016 at 1:03:04 PM GMT + 05: 30 in the childGrid. But if I do it in the Grid master, I have no problem
The configuration of locale the hagon with the cldr files. I have a partial view where I load the cldr files
<script>
    document.addEventListener("DOMContentLoaded", function () {
        ej.base.L10n.load({
            'es-MX': {
                'grid': {
                    "GroupDropArea": "Arrastre una columna para agrupar",
                    "autoFitAll": "Ajuste automático de todas las columnas",
                    "autoFit": "Ajuste automatico de esta columna",
                    "Group": "Agrupar sobre esta columna",
                    "Ungroup": "Desagrupar sobre esta columna",
                    "SortAscending": "Ordenar ascendente",
                    "SortDescending": "Ordenar descendente",
                    "Columnchooser": "Mostrar/Ocultar columnas",
                    "FilterMenu": "Filtrado",
                    "FilterButton": "Filtrar",
                    "ClearButton": "Limpiar",
                    "StartsWith": "Empieza con...",
                    "EndsWith": "Termina con...",
                    "Contains": "Contiene",
                    "Equal": "Igual a",
                    "NotEqual": "Diferente de",
                    "LessThan": "Menor que",
                    "LessThanOrEqual": "Menor o igual que",
                    "GreaterThan": "Mayor que",
                    "GreaterThanOrEqual": "Mayor o igual que",
                    "EnterValue": "Introduzca un valor",
                    "Excelexport": "Exportar",
                    "Add": "Nuevo registro",
                    "Update": "Guardar",
                    "Cancel": "Cancelar",
                    "EditOperationAlert": "Seleccione un registro para editar",
                    "DeleteOperationAlert": "Seleccione un registro para dar de baja",
                    "Search": "Busqueda",
                    "Edit": "Editar",
                    "Delete": "Baja",
                    "ClearFilter": "Limpiar filtro",
                    "UnGroup": "Haga clic aqui para desagrupar",
                    "SelectAll": "Seleccionar todo",
                    "CancelButton": "Cancelar",
                    "TextFilter": "Criterio de filtrado",
                    "EmptyRecord": "No hay registros",
                    'Item': 'Equipo',
                    'Items': 'Equipos'
                },
                'pager': {
                    "FirstPage": "Primera página",
                    "LastPage": "Ultima página",
                    "PreviousPage": "Página anterior",
                    "NextPage": "Página siguiente",
                    "currentPageInfo": "Página {0} de {1}",
                    "totalItemsInfo": "({0} registros)",
                    "previousPageTooltip": "Página anterior",
                    "nextPageTooltip": "Página siguiente",
                    "previousPagerTooltip": "Página anterior",
                    "nextPagerTooltip": "Página siguiente",
                    "firstPageTooltip": "Ir a la primera página",
                    "lastPageTooltip": "Ir a la última pagina"
                }
            }
        });
    })


    function loadCultureFiles(name) {
        var files = ['ca-gregorian.json', 'numbers.json', 'timeZoneNames.json', 'currencies.json'];
        var loadCulture = function (prop) {
            var val, ajax;
            ajax = new ej.base.Ajax(location.origin + '/../../scripts/cldr-data/main/' + name + '/' + files[prop], 'GET', true);
            ajax.onSuccess = function (value) {
                val = value;
                ej.base.loadCldr(JSON.parse(val));
            };
            //ajax.send();
            //ej.base.setCulture('es');
            //ej.base.setCurrencyCode('MXN');
            ajax.send().then(function (args) {
                ej.base.setCulture('es-MX');
                ej.base.setCurrencyCode('MXN');
            });
        };
        for (var prop = 0; prop < files.length; prop++) {
            loadCulture(prop);
        }
    }
    document.addEventListener('DOMContentLoaded', function () {
        loadCultureFiles('es-MX');
    });
</script>
How can I do the configuration? I hope you can help me. Thanks in advance

Seeni Sakthi Kumar Seeni Raj [Syncfusion]
Replied On November 22, 2019 06:48 AM UTC

Hi Juan,  

Greetings from Syncfusion.  

To format the Grid columns, you must update the columns.format. Refer to the following Help Document.  


If you are still facing any problem, please share a JSON data bound to the Grid and its Grid definition. 

Regards,  
Seeni Sakthi Kumar S 


Juan Cruz
Replied On November 22, 2019 08:34 PM UTC

Here is my code

Attachment: Consulta_698e6036.rar

Seeni Sakthi Kumar Seeni Raj [Syncfusion]
Replied On November 25, 2019 06:59 AM UTC

Hi Juan,  

We can reproduce the problem at our end. Since you are using the custom date format, the reported problem occurred. So we suggest to assign the type/format for the date column in the load event of the Grid as follows.  

    function onLoad() { 
      // date column 
      this.columns[3].format = { type: 'dateTime', format: 'dd.MM.yyyy' }; 
    } 

@Html.EJS().Grid("DialogTemplateEdit").DataSource((IEnumerable<object>)ViewBag.DataSource).Load("onLoad") 
 . . . 
           . . . 
.AllowPaging().Render() 


Regards,  
Seeni Sakthi Kumar S 


Juan Cruz
Replied On November 25, 2019 11:30 PM UTC

I already made the corrections and it works. I only have one question left: Can I add a search bar in the parent grid and can I search for records at any level?

Seeni Sakthi Kumar Seeni Raj [Syncfusion]
Replied On November 26, 2019 07:04 AM UTC

Hi Juan,  

Thanks for contacting Syncfusion Support.   
  
We could see you would like to search the child Grid records on giving values for the parent Grid’s search tool.  We will not support the searching of the child Grid records from the parent records. Since they are possessing the different datasets and rendering as a separate control from the parent Grid, it is not feasible to implement this requirement.  

Regards,  
Seeni Sakthi Kumar S

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon