Oct 22, 2010, 1:02 PM
[CLOSED] TimeField Conversion
Hi,
I have a some data with a TIME field: it specifies some schedule time during the day.
I'm storing it in a DateTime object and using a TimeField for the editing.
When i do the editing it "explodes".
I think it is a problemn of conversion from the time string to the javscript Date object.
i tried doing something on the beforeComplete event but no good news. Any suggestion?
I have a some data with a TIME field: it specifies some schedule time during the day.
I'm storing it in a DateTime object and using a TimeField for the editing.
When i do the editing it "explodes".
I think it is a problemn of conversion from the time string to the javscript Date object.
i tried doing something on the beforeComplete event but no good news. Any suggestion?
<%@ Page Language="C#" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
public class DataRecord
{
public int Id { get; set; }
public DateTime Time { get; set; }
}
protected void Page_Load(object sender, EventArgs e)
{
this.DataStore.DataSource = this.GetData();
this.DataStore.DataBind();
}
private List<DataRecord> GetData()
{
return new List<DataRecord>
{
new DataRecord { Id = 1, Time = DateTime.Now},
new DataRecord { Id = 2, Time = DateTime.Now },
new DataRecord { Id = 3, Time = DateTime.Now },
};
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Example</title>
</head>
<body>
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:Store runat="server" ID="DataStore">
<Reader>
<ext:JsonReader IDProperty="Id">
<Fields>
<ext:RecordField Name="Id" Type="Int" />
<ext:RecordField Name="Time" Type="Date"/>
</Fields>
</ext:JsonReader>
</Reader>
</ext:Store>
<ext:Viewport runat="server" ID="Viewport" Layout="Fit">
<Items>
<ext:GridPanel
runat="server"
ID="GridPanel"
StoreID="DataStore"
Title="Table"
Icon="Table"
Frame="true">
<ColumnModel ID="ColumnModel" runat="server">
<Columns>
<ext:Column Header="ID" DataIndex="Id" />
<ext:DateColumn Header="Time" DataIndex="Time" Format="H:mm" >
<Editor>
<ext:TimeField runat="server" Increment="30" Format="H:mm" />
</Editor>
</ext:DateColumn>
</Columns>
</ColumnModel>
</ext:GridPanel>
</Items>
</ext:Viewport>
</body>
</html>
Last edited by Daniil; Oct 22, 2010 at 5:29 PM.
Reason: [CLOSED]