im trying to fetch data from some localhost api and show it on a kendo grid, but nothing happens, dont know where is the mistake:
In Postman i get results from this localhost GET
Only error showed is cookied related
Thanks in advance!
<!DOCTYPE html>
<html>
<head>
<title></title>
<link href="https://kendo.cdn.telerik.com/2021.2.616/styles/kendo.common.min.css" rel="stylesheet" />
<link href="https://kendo.cdn.telerik.com/2021.2.616/styles/kendo.default.min.css" rel="stylesheet" />
<script src="https://kendo.cdn.telerik.com/2021.2.616/js/jquery.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2021.2.616/js/kendo.all.min.js"></script>
</head>
<body>
<script src="//kendo.cdn.telerik.com/2016.1.112/js/pako_deflate.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jszip/2.4.0/jszip.min.js"></script>
<div id="example">
<div id="grid"></div>
<script>
var inputLe = localStorage.getItem("storageLe");
$(document).ready(function () {
var gridDataSource = new kendo.data.DataSource({
transport: {
read:{
url: "localhost:3000/api/chirps",
dataType: "json",
type: "GET"
}
},
pageSize: 20,
serverFiltering : true,
filter : [
{field: "Legal_Entity", operator: "eq", value: "3800" },
]
});
$("#grid").kendoGrid({
datasourece: gridDataSource,
height: 550,
groupable: true,
sortable: true,
pageable: {
refresh: true,
pageSizes: true,
buttonCount: 5
},
columns: [{
field: "Inv_Number",
title: "Invoice Number"
}, {
field: "Inv_Date",
title: "Invoice Date"
}, {
field: "Vat_Amout",
title: "Vat Amount"
}, {
field: "Net",
title: "Net"
}, {
field: "Category",
title: "Category"
}, {
field: "Commen",
title: "Comment"
}, {
field: "Legal_Entity",
title: "Lega Entity"
}, {
field: "Quart",
title: "Quarter"
}, {
field: "Confirmed",
title: "Confirmed"
}, {
field: "Stat",
title: "Status"
}
]
});
});
window.localStorage.removeItem("storageLe");
</script>
</div>
</body>
</html>
In addition I fixed a typo on the "dataSource" on the kendo grid fuction, i also remove the server filtering and add a schema but the grid doesnt populate...
Here some example of the return i get from the API:
{"id": 512,
"Inv_Number": "00000",
"Inv_Date": "2000-05-01T03:00:00.000Z",
"Vat_Amout": -999.99,
"Net": 0,
"Category": "00",
"Commen": "Some comment",
"Legal_Entity": "1234",
"Quart": "2",
"Confirmed": 1,
"Stat": 1
}