[CLOSED] Date format in PropertyGrid

  1. #1

    [CLOSED] Date format in PropertyGrid

    Hi,

    I have a PropertyGrid (Ext.Net MVC 2.5.2) and some parameters (line in the grid) are of type date. The editor has the format I specified ("dd/MM/yyyy") but after I finish to edit (so after the editor is done) the format of the date become "MM/dd/yyyy". I have tried the solution from http://www.sencha.com/forum/showthre...n-PropertyGrid, I have put this in my page:

    <script>
        if (Ext.grid.PropertyColumnModel) {
            Ext.apply(Ext.grid.PropertyColumnModel.prototype, {
                nameText: "Nume",
                valueText: "Valoare",
                dateFormat: "dd/MM/yyyy"
            });
        }
    </script>
    The name of the columns "Name" and "Value" are changed with the names I supplied, but the date format remains wrong ("MM/dd/yyyy").

    The PropertyGrid is very simple:

    Html.X().PropertyGrid()
                .Title("<b>Atribute</b>")
                .NameColumnWidth(400)                        
                .ID("AttributesPropertyGrid" + entityId)
                .Height(150)
    The source is set on the server-side:

    var paramCollection = new PropertyGridParameterCollection();
    var param = new PropertyGridParameter();
    param.Name = attr.Name;
    param.Editor.Add(new DateField() { Format = "dd/MM/yyyy" });                    
    paramCollection.Add(param);
    
    var attributesPropertyGrid = this.GetCmp<PropertyGrid>("AttributesPropertyGrid" + entityId.ToString());
    attributesPropertyGrid.SetSource(paramCollection, true);
    Thanks!
    Last edited by Daniil; Oct 22, 2014 at 6:52 AM. Reason: Please use [CODE] tags, [CLOSED]
  2. #2
    Hi @developeriw,

    Welcome to the Ext.NET forums!

    Please use:
    Ext.grid.PropertyColumnModel.override({
        nameText: "Nume",
        valueText: "Valoare",
        renderDate: Ext.util.Format.dateRenderer("j/m/Y")
    });
  3. #3
    Thanks Daniil, it works!

Similar Threads

  1. Replies: 8
    Last Post: May 20, 2013, 4:01 AM
  2. Replies: 3
    Last Post: May 09, 2012, 4:28 PM
  3. Replies: 1
    Last Post: Apr 13, 2012, 1:52 PM
  4. Replies: 4
    Last Post: Jun 30, 2011, 3:30 PM
  5. [CLOSED] How to Set Date Format in a Coolite Date Field
    By speedstepmem3 in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Dec 02, 2010, 8:47 AM

Posting Permissions