ASP.NET JSON Formatted Dates and Formatting in GridPanel

  1. #1

    ASP.NET JSON Formatted Dates and Formatting in GridPanel

    Hi all,

    Just been trying to format a date returned by an ASP.NET webservice, but due to the way the asp.net team decided to use their +"/Date(###)/" date format for the response I'm having trouble getting the coolite grid to format it correctly.

    I know I could return a formatted string, but I really didn't want to have to modify my objects data types just to resolve a formatting issue.

    Could someone point me in the right direction?!!

    Thanks

    Matt
  2. #2

    RE: ASP.NET JSON Formatted Dates and Formatting in GridPanel

    Just for future info, I got around this by applying a custom Convert function on the Store RecordField like this:

    <ext:RecordField Name="TestDate" Mapping="TestDate">
        <Convert Fn="dateConverter" />
    </ext:RecordField>
    The function looked something like this (not elegant I know!!):

    function dateConverter(date) {
    try {
        date = date.replace("/Date(", "").replace(")/", "");
        date = parseInt(date);
    } catch (err) {}
        var myDate = new Date(date);
        return myDate;
    }
    Regards

    Matt
  3. #3

    RE: ASP.NET JSON Formatted Dates and Formatting in GridPanel

    Hi Matt,

    The following post might help as well, see http://forums.ext.net/showthread.php?postid=14046.aspx


    Basically the same thing.


    Geoffrey McGill
    Founder & CEO
  4. #4

    RE: ASP.NET JSON Formatted Dates and Formatting in GridPanel

    Thanks for this

Similar Threads

  1. [CLOSED] Dates & Json & ComboBoxes
    By PhilG in forum 1.x Premium Help
    Replies: 3
    Last Post: May 24, 2012, 2:45 PM
  2. Replies: 10
    Last Post: Aug 01, 2011, 1:58 PM
  3. 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
  4. Replies: 2
    Last Post: Oct 05, 2010, 10:29 AM
  5. Currency Formatting Issue in GridPanel
    By syed2uk in forum 1.x Help
    Replies: 3
    Last Post: Oct 15, 2009, 5:35 PM

Posting Permissions