Date recordfield in gridpanel

  1. #1

    Date recordfield in gridpanel

    Hi,




    The situtation is as following

    1. We are getting data from webservice. In webservice we are getting data in dataset. We are serilizing it into json using json.Net library (serilize method).

    2. We are have a grid in web page. We have assigned json reader to our store and we have assigned store to gridpanel. Store contains RecordField of Type Date

    3. store reads data from httpproxy.


    4. But nothing shows up in date column in gridpanel.
    When the type in RecordField is changed to string we get data in column like this ..

    /Date(1232044200000+0530)/


    We want to show date as per locale format. What changes should we do to accomplish this?

    Thanks & Regards
    Parag Mulay
  2. #2

    RE: Date recordfield in gridpanel

    I just wanted to add that I'm running into the same issue. The following is an excerpt of the json response:

    ..."Date":"\/Date(1262889462790)\/",...

  3. #3

    RE: Date recordfield in gridpanel

    Ok, I found it...this was previously answered by vladimir here.

    I also wanted to add how you do it in code behind, though, since I've got it working now:

    //if statement here
    string strHandler=@"return Ext.decode(value.replace(/\/(Date\([0-9-]+\))\//gi, 'new $1'));";
    //end if
    
    RecordField rf = new RecordField(name, recordFieldType);
                    if(strHandler != null)
                        rf.Convert = new JFunction(strHandler);
  4. #4

    RE: Date recordfield in gridpanel

    If you control the Json Serialization, I would highly recommend serializing DateTime objects into their ISO 8601 format and avoid the overhead associated with the Microsoft pseudo DateTime serialization.

    "yyyy-MM-ddTHH:mm:ss"


    Geoffrey McGill
    Founder
  5. #5

    RE: Date recordfield in gridpanel

    Geoffrey,

    I'm using the default json serialization used with the [ScriptService] attribute on a Web Service. I'm not sure how to do it offhand, so I'll have to look into overriding the default serialization when I get some extra time. Thanks for the suggestion.

Similar Threads

  1. [CLOSED] Problem with Converter on Date RecordField
    By GLD in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: May 31, 2012, 1:44 PM
  2. [CLOSED] Default date format for Type="Date" RecordField
    By r_honey in forum 1.x Legacy Premium Help
    Replies: 12
    Last Post: May 29, 2012, 3:16 PM
  3. Replies: 4
    Last Post: May 22, 2012, 10:40 AM
  4. [CLOSED] DefaultValue for Date RecordField
    By SouthDeveloper in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Nov 17, 2011, 2:55 PM
  5. RecordField type="date" in coolite 0.8
    By dperera in forum 1.x Help
    Replies: 8
    Last Post: Sep 01, 2009, 5:49 PM

Posting Permissions