[CLOSED] date rendering in grid panel

  1. #1

    [CLOSED] date rendering in grid panel

    Hi all,

    I am having a problem with the grid panel, when I use a date column some of the dates are not being rendered correctly.
    I have built a little demo that demonstrates the problem. What happens is the records are simply blank, and it appears to only happen when the day part of the date is <= 9. I need to use the DateColumn and not just a standard column because I am using client side filtering and it doesn't work properly without using a DateColumn. It also doesn't seem to matter what format I use for the date values e.g. Y/m/d or d/m/y etc

    It may this is a bug, but more likely I am just doing something wrong :) I am using C# and MVC, and using Ext 4.0, Ext.Net 2.2

    here is the controller code

    public class HomeController : Controller
        {
            public ActionResult StoreData()
            {
                return Content(@"
                [{
                        ""contractedShipDate"": null
                    },{
                        ""contractedShipDate"": ""2007-02-22""
                    },{
                        ""contractedShipDate"": ""2013-03-13""
                    },{
                        ""contractedShipDate"": ""2012-12-18""
                    },{
                        ""contractedShipDate"": ""2010-11-03""
                    },{
                        ""contractedShipDate"": ""2012-12-09""
                    }
                ]");
            }
        }
    }
    and here is the view

    @(Html.X().GridPanel()
        .Width(600)
        .Height(300)
        .Store(store => store.Add(Html.X().Store()
            .AutoLoad(true)
            .Proxy(proxy => proxy.Add(Html.X().AjaxProxy()
                    .Url(Url.Content(@"~/Home/StoreData"))
                )
            )
            .Model(mdl => mdl.Add(Html.X().Model()
                            .Fields(fields => fields.Add(Html.X().ModelField()
                                .Name("contractedShipDate")
                                .Type(Ext.Net.ModelFieldType.Date)
                                .DateReadFormat("Y-m-d")
                            )
                        )
                    )
                )
            )           
        )
        .ColumnModel(col => col.Columns.Add(Html.X().DateColumn()
                .DataIndex("contractedShipDate")
                .Format("d/m/Y")
            )
        )     
    )
    If anyone has any idea's I would greatly appreciate your feedback.

    Cheers,
    Eddie
    Last edited by Daniil; Sep 26, 2013 at 6:32 AM. Reason: [CLOSED]
  2. #2
    Hi Eddie,

    Please use:
    .DateReadFormat("yyyy-MM-dd")
    It expects a .NET date format string.
  3. #3

    fixed!

    Daniil, thanks for your reply. That was the problem and it's working perfectly now, thanks a lot :)

Similar Threads

  1. [CLOSED] Grid panel cell is not rendering after insert
    By bayoglu in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Feb 06, 2013, 12:49 PM
  2. Problem of rendering tha last column of Grid panel
    By pars.engineer in forum 1.x Help
    Replies: 0
    Last Post: Oct 10, 2012, 8:08 AM
  3. date time field in grid panel
    By sunshine in forum 1.x Help
    Replies: 1
    Last Post: Jul 28, 2011, 12:53 AM
  4. formatting of json date in a Grid Panel
    By Ratoun in forum 1.x Help
    Replies: 0
    Last Post: Nov 08, 2010, 8:14 AM
  5. Replies: 2
    Last Post: Apr 09, 2010, 11:28 AM

Tags for this Thread

Posting Permissions