[CLOSED] Date Value is not getting formatted during Edit mode in Grid Panel

  1. #1

    [CLOSED] Date Value is not getting formatted during Edit mode in Grid Panel

    I want to Add a New Row in the Grid, I am using following function for that.

    function NewRow() {
    var rowIndex = GrdPnl1.addRecord();
    var record = GrdPnl1.store.getAt(rowIndex);
    record.data.qdelivery_date_from = "06-08-2010";
    GrdPnl1.getView().refreshRow(rowIndex);
    GrdPnl1.getView().focusRow(parseInt(rowIndex));
    GrdPnl1.startEditing(parseInt(rowIndex),0);
    }
    The problem is it shows 08-06-2010 during focus on first cell, if i move focus to the cell ETD_From it shows 06-08-2010 and lost focus from the cell it shows 06-08-2010, i want the value 06-08-2010 during the first time itself :confused:, pls help me on this.

    This is My Store:
    -------------------

    <ext:Store ID="storePriceInquiry" runat="server" IgnoreExtraFields="true" WarningOnDirty="false">
    <Reader>
    <ext:JsonReader ReaderID="Key">
    <Fields>
    <ext:RecordField Name="qdelivery_date_to" Type="Date" DateFormat="dd-MM-yyyy" />
    <ext:RecordField Name="qdelivery_date_from" Type="Date" DateFormat="dd-MM-yyyy" />
    </Fields>
    </ext:JsonReader>
    </Reader>
    </ext:Store>
     
    This is My Grid:
    -----------------
    <ext:GridPanel ID="GrdPnl1" runat="server" StoreID="storePriceInquiry" Border="false"
    AutoScroll="true" ClicksToEdit="2">
    <ColumnModel ID="ColumnModel1" runat="server">
    <Columns>
    <ext:Column Header="ETD" Sortable="true" DataIndex="qdelivery_date_to" ColumnID="delivery-date"
    MenuDisabled="true">
    <Editor>
    <ext:DateField ID="Date_Etd_to" AllowBlank="false" runat="server" Width="175" Cls="manitatory" DataIndex="qdelivery_date_to">
    </ext:DateField>
    </Editor>
    
    </ext:Column>
    <ext:Column Header="ETD_From" Sortable="true" DataIndex="qdelivery_date_from" ColumnID="delivery-date"
    MenuDisabled="true">
    <Editor>
    <ext:DateField ID="Date_Etd" AllowBlank="false" runat="server" Width="175" Cls="manitatory" DataIndex="qdelivery_date_from">
    </ext:DateField>
    </Editor>
    
    </ext:Column>
    
    </Columns>
    </ColumnModel>
    <View>
    <ext:GridView ID="GridView1" ForceFit="false" runat="server" EnableRowBody="false">
    </ext:GridView>
    </View>
    <SelectionModel>
    <ext:CheckboxSelectionModel HideCheckAll="true" ID="CheckboxSelectionModel1" runat="server">
    </ext:CheckboxSelectionModel>
    </SelectionModel>
    
    <Plugins>
    <ext:GridPanelMaintainScrollPositionOnRefresh ID="GridPanelMaintainScrollPositionOnRefresh1"
    runat="server">
    </ext:GridPanelMaintainScrollPositionOnRefresh>
    </Plugins>
    <Buttons>
    <ext:Button ID="btnAdd" runat="server" Text="Add" AutoPostBack="false" IconCls="add">
    <Listeners>
    <Click Handler="NewRow()" />
    </Listeners>
    </ext:Button>
    </Buttons>
    
    <BottomBar>
    <ext:PagingToolbar ID="PagingToolBar1" runat="server" StoreID="storePriceInquiry"
    DisplayInfo="true" PageSize="10" />
    </BottomBar>
    </ext:GridPanel>
    Last edited by geoffrey.mcgill; Aug 12, 2010 at 10:01 PM. Reason: please use [CODE] tags
  2. #2
    Hi,

    Please try the following code
    function NewRow() {
        var rowIndex = GrdPnl1.addRecord();
        var record = GrdPnl1.store.getAt(rowIndex);
        record.set("qdelivery_date_from", new Date(2010, 8, 6));
        GrdPnl1.getView().focusRow(rowIndex);
        GrdPnl1.startEditing(rowIndex, 0);
    }
    Vladimir Shcheglov
    Sr. Developer

Similar Threads

  1. [CLOSED] Detect Grid Edit Mode
    By rthiney in forum 1.x Premium Help
    Replies: 4
    Last Post: Aug 25, 2011, 7:18 PM
  2. Replies: 7
    Last Post: Aug 12, 2011, 2:30 PM
  3. Replies: 4
    Last Post: Jun 30, 2011, 3:30 PM
  4. Replies: 3
    Last Post: Jun 03, 2011, 12:10 PM
  5. Replies: 2
    Last Post: Oct 05, 2010, 10:29 AM

Posting Permissions