rendering date difference in a gridpanel column

  1. #1

    rendering date difference in a gridpanel column

    Hello, I've some problem rendering date difference in a gridpanel column.

    I'm trying to get difference (in days) between a date in the same row and today's date. But the return value is always "NaN".

    Is there something wrong with the handler?

    Here's my code,

    <body style="background-color: #DFE8F6">
        <form id="form1" runat="server">
         <ext:ResourceManager ID="ResourceManager1" runat="server" />
         <ext:Hidden ID="HiddenField1"  name ="HiddenField1" runat="server"></ext:Hidden>
         <ext:Hidden ID="HiddenField2"  name ="HiddenField2" runat="server"></ext:Hidden>
         <ext:Hidden ID="HiddenField3"  name ="HiddenField3" runat="server"></ext:Hidden>
            <br />
            <table width="98%" align="center">
            <ext:TabPanel ID="TabPanel1" runat="server" DeferredRender="false" Layout="ColumnLayout" Border="false" BodyStyle="background-color: #DFE8F6" Frame="true" Autoscroll="True" Anchor="100% 100%">
                    <ext:Panel ID="Panel1" runat="server" Title="New">
                            <ext:GridPanel ID="GridPanel4" runat="server" Title="" overflow="auto" fitToFrame="true" Anchor="100% 100%">
                                    <ext:Store runat="server" ID="strNew">
                                            <ext:Model runat="server" ID="Model3">
                                                    <ext:ModelField Name="ProjectID" Type="String" />
                                                    <ext:ModelField Name="CreateDate" Type="String"/>
                                        <ext:Column ID="Column1" runat="server" Text="ProjectID" Width="80" DataIndex="ProjectID" />
                                        <ext:Column ID="Column7" runat="server" Text="Aging" Width="80">
                                            <Renderer handler="var today = Date.parse(; var createdt = Date.parse(; var diffDays = Math.round(parseInt(today-createdt) / (86400000));  return diffDays;" />
                                        <ext:Column ID="Column13" runat="server" Text="Create Date" Width="100" DataIndex="CreateDate" />
    Thanks before.
  2. #2
    Just found the solution. I parsed the dates to integer first. Thanks anyway.

    <Renderer handler="var today =; createdt = Date.parse(; return Math.floor((parseInt(today)-parseInt(createdt))/(86400000));" />

Similar Threads

  1. Replies: 1
    Last Post: Apr 02, 2013, 6:51 AM
  2. [CLOSED] Difference between GridPanel ForceFit vs Column Flex?
    By jchau in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Jan 23, 2013, 3:24 PM
  3. Replies: 0
    Last Post: Sep 13, 2011, 4:25 PM
  4. [CLOSED] Gridpanel second Column data Rendering a Jiberish
    By SymSure in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Apr 01, 2010, 6:35 PM
  5. Replies: 3
    Last Post: May 09, 2009, 1:15 PM

Tags for this Thread

Posting Permissions