Help on Date Column

  1. #1

    Help on Date Column

    Hi there,

    I need help from you guys on following. I got a GridPanel using RowEditor that has Date column/s in it. My application has to comply with localization. In the Date column, I have to display date as a formatted localized value (string) and while editing, I want to use the regular date control (no matter if I have to use English as contol's local) we have in Ext.Net.

    I already been trying on this. So far Im able to display the formatted localized Date String (DataIndex="DateOfJoining" in given snippet) but Im stucked on how to display the formatted date after edit. My sample snippet on DateColumn is given below. Any help or example will be truly appreciated.

                                        <ext:Column DataIndex="DateOfJoining" Header="DOJ" Width="80" editable="true">
                                            <Editor>
                                                <ext:DateField runat="server" Format="dd-MM-yyyy">
                                                    <DirectEvents>
                                                        <Blur OnEvent="Date_Changed"/>
                                                    </DirectEvents>
                                                </ext:DateField>
                                            </Editor>
                                        </ext:Column>
    Thanks
  2. #2
    Hi,

    If you change your <ext:Column> to an <ext:DateColumn>, you'll have access to the .Format property.

    Example

    <ext:DateColumn DataIndex="DateOfJoining" Header="DOJ" Width="80" editable="true" Format="dd-MM-yyyy">    <Editor>
            <ext:DateField runat="server" Format="dd-MM-yyyy">
                <DirectEvents>
                    <Blur OnEvent="Date_Changed"/>
                </DirectEvents>
            </ext:DateField>
        </Editor>
    </ext:DateColumn>
    Hope this helps.
    Geoffrey McGill
    Founder & CEO
  3. #3
    Hi Geoffrey,

    Thanks for your prompt assistance. Well, think I couldn't state my problem clearly, sorry for that. I tried earlier the way you suggested, but it didn't work. It raised an exception for inproper data format. It was obvious. Since The Column's DataIndex (DataIndex="DateOfJoining") is mapped to a String Type object property (<ext:RecordField Name="DateOfJoining" Mapping="StringDateOfJoining" Type="String"/>). This object property actually holds a string of converted datetime to local (bn-IN) language. So when date column was trying to format it (dd-MM-yyyy), it was throwing an exception since it couldn't recognise the value as any valid date.

    I need to display the formatted string (localized) of date (it is working now), when editing, I need to use the regular EXT.Net date control (as it is in english, since I can't localize it to bn-IN). It is also done. But After edit, I have to convert the date to local string again and display it and Im stucked on this part.

    Please feel free if you require any further clarification. Thanks again.
  4. #4
    You can use column renderer to format display value as required
    Vladimir Shcheglov
    Sr. Developer
  5. #5
    Quote Originally Posted by Vladimir View Post
    You can use column renderer to format display value as required
    Thanks Vladimir, but how can I call a serverside method in column renderer rather than calling a javascript function? I have the formatting method in my serverside utility class. Any small example or reference?
  6. #6
    Quote Originally Posted by reezvi View Post
    Thanks Vladimir, but how can I call a serverside method in column renderer rather than calling a javascript function? I have the formatting method in my serverside utility class. Any small example or reference?
    Hi reezvi,

    With a Column Renderer a server-side call is not possible. The logic for rendering the column must be created client-side within a JavaScript call.
    Geoffrey McGill
    Founder & CEO
  7. #7
    Quote Originally Posted by geoffrey.mcgill View Post
    Hi reezvi,

    With a Column Renderer a server-side call is not possible. The logic for rendering the column must be created client-side within a JavaScript call.
    Thanks Geoffrey. In that case Im trying to get my requirements done with ColumnRenderer to a JavaScript call. I'll let you know the progress and if the issue can be flagged as Closed. Thanks again.

Similar Threads

  1. [1.3] Date column on GridPanel
    By quangtt in forum 1.x Help
    Replies: 4
    Last Post: Mar 11, 2012, 8:21 PM
  2. I want to change Grid Date column dynamically?
    By mohankumar in forum 1.x Help
    Replies: 0
    Last Post: Feb 15, 2012, 7:42 AM
  3. Replies: 2
    Last Post: Jan 23, 2012, 11:49 AM
  4. Excel export , column header and Null date field
    By springrider in forum 1.x Help
    Replies: 1
    Last Post: Oct 13, 2011, 6:12 PM
  5. Date column on GridPanel not displaying
    By lionelhutz in forum 1.x Help
    Replies: 0
    Last Post: Nov 16, 2009, 6:47 PM

Posting Permissions