1. #1
    Sencha User
    Join Date
    Apr 2012
    Posts
    1
    Vote Rating
    0
    sa_kurup is on a distinguished road

      0  

    Default Nullable Datetime field not getting rendered in Store (Ext JS)

    Nullable Datetime field not getting rendered in Store (Ext JS)


    <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>
    In this store the fields SampleStartDate and SampleEndDate are of type Nullabe Datetime (Datetime?) in the model. In controller i am getting value for every field and i am converting this to StoreResult in the function GetSampleList. But in store i am always getting the value as 'undefined' in these two fields. But if i change the datatype from Datetime? to DateTime the in model i am getting all the values in store.Can any one help me to get the nullable datetime value in store?

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,080
    Vote Rating
    467
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    Please try the following code and make any adjustments as needed to simulate your problem:

    Code:
    Ext.application({
        name: 'test',
        launch: function () {
            Ext.define('Company', {
                extend: 'Ext.data.Model',
                fields: [{
                    name: 'id',
                    type: 'int'
                }, {
                    name: 'todate',
                    type: 'date'
                }]
            });
    
            Ext.define('Companies', {
                model: 'Company',
                extend: 'Ext.data.Store'
            });
    
            var store = Ext.create('Companies');
    
            store.loadRawData([{
                "id": 1,
                "todate": "2011-08-08"
            }, {
                "id": 2,
                "todate": null
            }, {
                "id": 3,
                "todate": "2011-08-09"
            }]);
    
            var grid = Ext.create('Ext.grid.Panel', {
                store: store,
                columns: [{
                    header: 'Id',
                    dataIndex: 'id'
                }, {
                    header: 'To',
                    dataIndex: 'todate',
                    xtype: 'datecolumn'
                }],
                columnLines: true,
                width: 600,
                height: 300,
                title: 'GRID',
                renderTo: Ext.getBody()
            });
        }
    });‚Äč
    Regards,
    Scott.

Thread Participants: 1

Tags for this Thread