<ext:Store ID="StoreSample" runat="server" RemotePaging="true" RemoteSort="true" AutoLoad="true"
ShowWarningOnFailure="false" >
<Proxy>
<ext:HttpProxy Url="~/Samples/OpenEdit/GetSampleList" Json="true">
</ext:HttpProxy>
</Proxy>
<Reader>
<ext:JsonReader IDProperty="Id" Root="data">
<Fields>
<ext:RecordField Name="Id" Type="Int">
</ext:RecordField>
<ext:RecordField Name="SampleDescription" Mapping="Description">
</ext:RecordField>
<ext:RecordField Name="SampleStartDate" Mapping="StartDate" Type="Date">
</ext:RecordField>
<ext:RecordField Name="SampleEndDate" Mapping="EndDate" Type="Date" >
</ext:RecordField>
</Fields>
</ext:JsonReader>
</ext:Store>
在此存储中,字段 SampleStartDate 和 SampleEndDate 在模型中属于 Nullabe Datetime (Datetime?) 类型。在控制器中,我获得了每个字段的值,并且我在函数 GetSampleList 中将其转换为 StoreResult。但是在商店中,我总是在这两个字段中将值设为“未定义”。但是,如果我从 Datetime 更改数据类型?在模型中的 DateTime 中,我正在获取存储中的所有值。
任何人都可以帮助我在商店中获取可为空的日期时间值吗?
我在 GridPanel 中使用这家商店
<Sample:GridPanel ID="GridPanelSample" runat="server" StoreID="StoreSample" Header="false"
AnchorHorizontal="right" AnchorVertical="96%" StandardPager="true" MonitorResize="true" TabIndex="15">
<TopBar>
</TopBar>
<ColumnModel>
<Columns>
<ext:Column runat="server" ColumnID="SampleDescription" Header="Description"
DataIndex="SampleDescription">
</ext:Column>
<ext:DateColumn runat="server" ColumnID="SampleStartDate" Header="StartDate"
DataIndex="SampleStartDate" Format="d MMM Y">
</ext:DateColumn>
<ext:DateColumn runat="server" ColumnID="SampleEndDate" Header="EndDate"
DataIndex="SampleEndDate" Format="d MMM Y">
</ext:DateColumn>
</Columns>
</ColumnModel>
<SelectionModel>
<ext:RowSelectionModel ID="RowSelectionModel1" runat="server" SingleSelect="true"
MoveEditorOnEnter="true">
</ext:RowSelectionModel>
</SelectionModel>
<View>
<ext:LockingGridView runat="server" ID="gridview1" />
</View>
<Listeners>
<ViewReady Handler="openEdit.setOpenEditGridColumnWidths();"></ViewReady>
</Listeners>
</Sample:GridPanel>
但 SampleStartDate 和 SampleEndDate 列始终为空