This is a migrated thread and some comments may be shown as answers.

Nested Gird e.slice is not a function

1 Answer 511 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Curtis
Top achievements
Rank 1
Curtis asked on 26 Jan 2017, 07:47 PM
I'm trying to make a grid inside the cell of another grid, but I keep getting this e.slice is not a function error. 

<div id=""RundownGrid""></div>
<script>
 
function RefreshRundowns() {
$(""#RundownGrid"").kendoGrid({
    scrollable: false,
    noRecords: true,
    pageable: false,
    columns: [
        {
            title: ""Inbound"",
            field: ""Inbound"",
            attributes: {
                ""id"": ""InboundGrid""
            },
            template: function RefreshInbounds(Inbound) {
                $(""#InboundGrid"").kendoGrid({
                    scrollable: false,
                    noRecords: true,
                    pageable: false,
                    columns: [
                        {
                            title: ""Vessel Name"",
                            field: ""VesselName"",
                            encoded: false,
                        },
         
                        {
                            title: ""Draft"",
                            field: ""CombinedDraft"",
 
                        },
                        {
                            title: ""Origination"",
                            field: ""CodesDescriptionFrom""
                        },
         
                        {
                            title: ""Destination"",
                            field: ""CodesDescriptionTo""
                        },
                        {
                            title: ""Time"",
                            field:""OrderTime"",
                            width: 33,
                        },
                        {
                            title: ""Pilots"",
                            field: ""CombinedPilots"",
                            encoded: false,
                        }
 
                    ],
                    dataSource:
                    {
                        type: ""json"",
                        transport: {
                            read: Inbound
                        }
                    },
                    schema: {
                        model: {
                            VesselName: {type: ""string""},
                            CombinedDraft: {type: ""string""},
                            CodesDescriptionFrom: {type: ""string""},
                            OrderTime: {type: ""string""},
                            CodesDescriptionTo: {type: ""string""},
                            CombinedPilots: {type: ""string""},
 
                        }
                    },
                    dataBound: function (e) {
        
        
                      var data = this._data;
         
         
 
                        for (var x = 0; x < data.length; x++) {
             
                            var di = data[x];
             
                            var tr = this.element.find(""[data-uid='"" + di.uid + ""']"");
                            if (di.IsDaylightOnlyJob) { tr.addClass(""DaylightJob""); }
                            if (di.IsTwoPilotJob) { tr.addClass(""TwoPilotJob""); }
 
                        }
                    }
 
                });
            },
            encoded: false,
        },
         
        {
            title: ""Shifts"",
            field: ""Shifts"",
            attributes: {
                ""id"": ""HarborShiftGrid""
            },
            template: """",
            encoded: false,
 
        },
        {
            title: ""Outbound"",
            field: ""Outbound"",
            attributes: {
                ""id"": ""OutboundGrid""
            },
            template: """",
            encoded: false,
        },
         
         
 
    ],
    dataSource:
    {
        type: ""json"",
        transport: {
            read: {
                url: RundownAPI + ""WallRundowns"",
                dataType: ""json"",
                type: ""GET"",
                contentType: ""application/json""
            }
        },
        schema: {
            model: {
                data: ""Inbound"",
                Shifts: {type: ""data""},
                Outbound: {type: ""data""},
             
 
            }
        },
    },
                                 
     
 
});
}

 

 

And a response from the data service would look like this (there's a lot of extra information in the response, I know)

 

{
  "Inbound": [
{
      "VesselName": "SEA BIRD",
      "CombinedDraft": "39.08",
      "CodesDescriptionFrom": "Sun Terminal #3 Hout",
      "CodesDescriptionTo": "SB Buoy",
      "OrderTime": "08:00",
      "StartDate": "01/09",
      "SbbTime": "-",
      "C09Time": "11:09",
      "C930Time": "-",
      "MsqptTime": "-",
      "NriTime": "10:13",
      "CombinedPilots": "S. D. WILLIAMS,<br> C. D. BANCROFT",
      "Sun5Time": "-",
      "ClearTime": "08:40",
      "PilotRestEarned": false,
      "SecondPilotRestEarned": false,
      "ThirdPilotRestEarned": false,
      "HasTransportation": false,
      "PilotHasTransportation": false,
      "SecondPilotHasTransportation": false,
      "ThirdPilotHasTransportation": false,
      "CallSign": "9V2730",
      "Conf": "Due",
      "Confirmed": false,
      "Direction": "OUTBOUND",
      "EstDateOnBoard": "2017-01-09T00:00:00",
      "ExtraYesNo": "N",
      "FirstPilotCode": 30,
      "IsDaylightOnlyJob": false,
      "IsOlder": false,
      "IsTwoPilotJob": true,
      "LastChange": "Daniel Dubois",
      "OnBoardDateTime": "0001-01-01T00:00:00",
      "OnBoardDate": "0001-01-01T00:00:00",
      "OrderDateTime": "2017-01-09T08:00:00",
      "PilotAboardDateTime": "0001-01-01T00:00:00",
      "PilotFinishTime": "0001-01-01T00:00:00",
      "PilotCode": 30,
      "PilotName": "S. D. WILLIAMS",
      "PilotPhone": "409-626-4805",
      "RundownDraftFeet": 39,
      "RundownDraftInches": 1,
      "RundownNotes": "ORDER",
      "SecondPilotCode": 0,
      "SecondPilotName": "C. D. BANCROFT",
      "ThirdPilotCode": 0,
      "ThirdPilotName": "",
      "TimeEstimate": "0800",
      "VesselBeam": 120.25,
      "VesselBredthFeet": 120.25,
      "VesselDwt": 52541,
      "VesselFlag": "SGP",
      "VesselHoldYesNo": "",
      "VesselHoldDescription": "",
      "VesselHoldDate": "0001-01-01T00:00:00",
      "VesselImo": "9726061",
      "Tugprimary": "",
      "VesselLoa": 738.25,
      "VesselNote": "NO THRUSTERS",
      "VesselRestriction": "2 PILOTS NON-DAYLIGHT",
      "VesselRestrictionDate": "1901-01-01T00:00:00",
      "AssignDate": null,
      "AssignDT": "0001-01-01T00:00:00"
    }
],
  "Shifts": [
    {
      "VesselName": "SEA BIRD",
      "CombinedDraft": "39.08",
      "CodesDescriptionFrom": "Sun Terminal #3 Hout",
      "CodesDescriptionTo": "SB Buoy",
      "OrderTime": "08:00",
      "StartDate": "01/09",
      "SbbTime": "-",
      "C09Time": "11:09",
      "C930Time": "-",
      "MsqptTime": "-",
      "NriTime": "10:13",
      "CombinedPilots": "S. D. WILLIAMS,<br> C. D. BANCROFT",
      "Sun5Time": "-",
      "ClearTime": "08:40",
      "PilotRestEarned": false,
      "SecondPilotRestEarned": false,
      "ThirdPilotRestEarned": false,
      "HasTransportation": false,
      "PilotHasTransportation": false,
      "SecondPilotHasTransportation": false,
      "ThirdPilotHasTransportation": false,
      "CallSign": "9V2730",
      "Conf": "Due",
      "Confirmed": false,
      "Direction": "OUTBOUND",
      "EstDateOnBoard": "2017-01-09T00:00:00",
      "ExtraYesNo": "N",
      "FirstPilotCode": 30,
      "IsDaylightOnlyJob": false,
      "IsOlder": false,
      "IsTwoPilotJob": true,
      "LastChange": "Daniel Dubois",
      "OnBoardDateTime": "0001-01-01T00:00:00",
      "OnBoardDate": "0001-01-01T00:00:00",
      "OrderDateTime": "2017-01-09T08:00:00",
      "PilotAboardDateTime": "0001-01-01T00:00:00",
      "PilotFinishTime": "0001-01-01T00:00:00",
      "PilotCode": 30,
      "PilotName": "S. D. WILLIAMS",
      "PilotPhone": "409-626-4805",
      "RundownDraftFeet": 39,
      "RundownDraftInches": 1,
      "RundownNotes": "ORDER",
      "SecondPilotCode": 0,
      "SecondPilotName": "C. D. BANCROFT",
      "ThirdPilotCode": 0,
      "ThirdPilotName": "",
      "TimeEstimate": "0800",
      "VesselBeam": 120.25,
      "VesselBredthFeet": 120.25,
      "VesselDwt": 52541,
      "VesselFlag": "SGP",
      "VesselHoldYesNo": "",
      "VesselHoldDescription": "",
      "VesselHoldDate": "0001-01-01T00:00:00",
      "VesselImo": "9726061",
      "Tugprimary": "",
      "VesselLoa": 738.25,
      "VesselNote": "NO THRUSTERS",
      "VesselRestriction": "2 PILOTS NON-DAYLIGHT",
      "VesselRestrictionDate": "1901-01-01T00:00:00",
      "AssignDate": null,
      "AssignDT": "0001-01-01T00:00:00"
    }
  ],
  "Outbound": [
   {
      "VesselName": "SEA BIRD",
      "CombinedDraft": "39.08",
      "CodesDescriptionFrom": "Sun Terminal #3 Hout",
      "CodesDescriptionTo": "SB Buoy",
      "OrderTime": "08:00",
      "StartDate": "01/09",
      "SbbTime": "-",
      "C09Time": "11:09",
      "C930Time": "-",
      "MsqptTime": "-",
      "NriTime": "10:13",
      "CombinedPilots": "S. D. WILLIAMS,<br> C. D. BANCROFT",
      "Sun5Time": "-",
      "ClearTime": "08:40",
      "PilotRestEarned": false,
      "SecondPilotRestEarned": false,
      "ThirdPilotRestEarned": false,
      "HasTransportation": false,
      "PilotHasTransportation": false,
      "SecondPilotHasTransportation": false,
      "ThirdPilotHasTransportation": false,
      "CallSign": "9V2730",
      "Conf": "Due",
      "Confirmed": false,
      "Direction": "OUTBOUND",
      "EstDateOnBoard": "2017-01-09T00:00:00",
      "ExtraYesNo": "N",
      "FirstPilotCode": 30,
      "IsDaylightOnlyJob": false,
      "IsOlder": false,
      "IsTwoPilotJob": true,
      "LastChange": "Daniel Dubois",
      "OnBoardDateTime": "0001-01-01T00:00:00",
      "OnBoardDate": "0001-01-01T00:00:00",
      "OrderDateTime": "2017-01-09T08:00:00",
      "PilotAboardDateTime": "0001-01-01T00:00:00",
      "PilotFinishTime": "0001-01-01T00:00:00",
      "PilotCode": 30,
      "PilotName": "S. D. WILLIAMS",
      "PilotPhone": "409-626-4805",
      "RundownDraftFeet": 39,
      "RundownDraftInches": 1,
      "RundownNotes": "ORDER",
      "SecondPilotCode": 0,
      "SecondPilotName": "C. D. BANCROFT",
      "ThirdPilotCode": 0,
      "ThirdPilotName": "",
      "TimeEstimate": "0800",
      "VesselBeam": 120.25,
      "VesselBredthFeet": 120.25,
      "VesselDwt": 52541,
      "VesselFlag": "SGP",
      "VesselHoldYesNo": "",
      "VesselHoldDescription": "",
      "VesselHoldDate": "0001-01-01T00:00:00",
      "VesselImo": "9726061",
      "Tugprimary": "",
      "VesselLoa": 738.25,
      "VesselNote": "NO THRUSTERS",
      "VesselRestriction": "2 PILOTS NON-DAYLIGHT",
      "VesselRestrictionDate": "1901-01-01T00:00:00",
      "AssignDate": null,
      "AssignDT": "0001-01-01T00:00:00"
    }
  ]
}

 

 

 

Any idea what I could be doing wrong here?

1 Answer, 1 is accepted

Sort by
0
Boyan Dimitrov
Telerik team
answered on 30 Jan 2017, 02:06 PM

Hello Curtis,

The schema.data is the field of the response where the data is stored. In the provided example the data field is placed inside the schema.model. The schema.model and schema.data should be on same level in the DataSource configuration. 

Regards,
Boyan Dimitrov
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Grid
Asked by
Curtis
Top achievements
Rank 1
Answers by
Boyan Dimitrov
Telerik team
Share this question
or