javascript - KendoUI grid not showing up with the data on the screen -
hi developing angular 2 application kendo ui controls. following example of kendo ui site set kendo grid. reason there no errors nothing showing on screen. data stored in local products.js file referred in application , bound datasource. please see code below
product.html
<!doctype html> <html> <head> <title></title> <link href="../../assets/css/kendo/2016.3.1028/kendo.common.min.css" rel="stylesheet" /> <link href="../../assets/css/kendo/2016.3.1028/kendo.default.min.css" rel="stylesheet"/> <link href="../../assets/css/kendo/2016.3.1028/kendo.default.mobile.min.css" rel="stylesheet" /> <script src="../../scripts/kendo/2016.3.1028/jquery.min.js"></script> <script src="../../scripts/kendo/2016.3.1028/kendo.all.min.js"></script> </head> <body> <script src="../../scripts/shared/products.js"></script> <div id="example"> <div id="grid"></div> <script> $(document).ready(function () { $("#grid").kendogrid({ datasource: { data: products, schema: { model: { fields: { productname: { type: "string" }, unitprice: { type: "number" } } } }, pagesize: 20 }, height: 550, scrollable: true, sortable: true, filterable: true, pageable: { input: true, numeric: false }, columns: [ { field: "productname", title: "units in stock", width: "130px" }, { field: "unitprice", title: "unit price", format: "{0:c}", width: "130px" }, ] }); }); </script> </div> </body> </html>
products.js
var products = [{ productid : 1, productname : "chai", supplierid : 1, categoryid : 1, quantityperunit : "10 boxes x 20 bags", unitprice : 18.0000, unitsinstock : 39, unitsonorder : 0, reorderlevel : 10, discontinued : false, category : { categoryid : 1, categoryname : "beverages", description : "soft drinks, coffees, teas, beers, , ales" } }, { productid : 2, productname : "chang", supplierid : 1, categoryid : 1, quantityperunit : "24 - 12 oz bottles", unitprice : 19.0000, unitsinstock : 17, unitsonorder : 40, reorderlevel : 25, discontinued : false, category : { categoryid : 1, categoryname : "beverages", description : "soft drinks, coffees, teas, beers, , ales" } }];
i have verified references javascript , css files , seem right. have tried check if there errors in console window using developer tools.
i don't see problem code.
could please provide info browser using , file structure of project? using complicated paths js , css files.
anyway i've setup 2 working examples you.
- codepen: http://codepen.io/xszaboj/pen/xnnkev
- github project github link
i doesn't answer question why don't see errors on page. hope help.
code same yours:
$(document).ready(function () { $("#grid").kendogrid({ datasource: { data: products, schema: { model: { fields: { productname: { type: "string" }, unitprice: { type: "number" } } } }, pagesize: 20 }, height: 550, scrollable: true, sortable: true, filterable: true, pageable: { input: true, numeric: false }, columns: [ { field: "productname", title: "units in stock", width: "130px" }, { field: "unitprice", title: "unit price", format: "{0:c}", width: "130px" }, ] }); });
here firefox network capture. please include yours github project compare?
Comments
Post a Comment