var source = { datatype: "xml", datafields: [ { name: 'ShippedDate', map: 'm\\:properties>d\\:ShippedDate', type: 'date' }, { name: 'Freight', map: 'm\\:properties>d\\:Freight', type: 'float' }, { name: 'ShipName', map: 'm\\:properties>d\\:ShipName' }, { name: 'ShipAddress', map: 'm\\:properties>d\\:ShipAddress' }, { name: 'ShipCity', map: 'm\\:properties>d\\:ShipCity' }, { name: 'ShipCountry', map: 'm\\:properties>d\\:ShipCountry' } ], root: "entry", record: "content", id: 'm\\:properties>d\\:OrderID', url: 'orders.xml' };
<entry><id>http://services.odata.org/Northwind/Northwind.svc/Orders(10248)</id><title type="text"></title><updated>2011-12-01T11:55:06Z</updated><author><name /></author><link rel="edit" title="Order" href="Orders(10248)" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Customer" type="application/atom+xml;type=entry" title="Customer" href="Orders(10248)/Customer" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Employee" type="application/atom+xml;type=entry" title="Employee" href="Orders(10248)/Employee" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Order_Details" type="application/atom+xml;type=feed" title="Order_Details" href="Orders(10248)/Order_Details" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Shipper" type="application/atom+xml;type=entry" title="Shipper" href="Orders(10248)/Shipper" /><category term="NorthwindModel.Order" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><content type="application/xml"><m:properties><d:OrderID m:type="Edm.Int32">10248</d:OrderID><d:CustomerID>VINET</d:CustomerID><d:EmployeeID m:type="Edm.Int32">5</d:EmployeeID><d:OrderDate m:type="Edm.DateTime">1996-07-04T00:00:00</d:OrderDate><d:RequiredDate m:type="Edm.DateTime">1996-08-01T00:00:00</d:RequiredDate><d:ShippedDate m:type="Edm.DateTime">1996-07-16T00:00:00</d:ShippedDate><d:ShipVia m:type="Edm.Int32">3</d:ShipVia><d:Freight m:type="Edm.Decimal">32.3800</d:Freight><d:ShipName>Vins et alcools Chevalier</d:ShipName><d:ShipAddress>59 rue de l'Abbaye</d:ShipAddress><d:ShipCity>Reims</d:ShipCity><d:ShipRegion m:null="true" /><d:ShipPostalCode>51100</d:ShipPostalCode><d:ShipCountry>France</d:ShipCountry></m:properties></content></entry><entry><id>http://services.odata.org/Northwind/Northwind.svc/Orders(10249)</id><title type="text"></title><updated>2011-12-01T11:55:06Z</updated><author><name /></author><link rel="edit" title="Order" href="Orders(10249)" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Customer" type="application/atom+xml;type=entry" title="Customer" href="Orders(10249)/Customer" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Employee" type="application/atom+xml;type=entry" title="Employee" href="Orders(10249)/Employee" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Order_Details" type="application/atom+xml;type=feed" title="Order_Details" href="Orders(10249)/Order_Details" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Shipper" type="application/atom+xml;type=entry" title="Shipper" href="Orders(10249)/Shipper" /><category term="NorthwindModel.Order" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><content type="application/xml"><m:properties><d:OrderID m:type="Edm.Int32">10249</d:OrderID><d:CustomerID>TOMSP</d:CustomerID><d:EmployeeID m:type="Edm.Int32">6</d:EmployeeID><d:OrderDate m:type="Edm.DateTime">1996-07-05T00:00:00</d:OrderDate><d:RequiredDate m:type="Edm.DateTime">1996-08-16T00:00:00</d:RequiredDate><d:ShippedDate m:type="Edm.DateTime">1996-07-10T00:00:00</d:ShippedDate><d:ShipVia m:type="Edm.Int32">1</d:ShipVia><d:Freight m:type="Edm.Decimal">11.6100</d:Freight><d:ShipName>Toms Spezialitäten</d:ShipName><d:ShipAddress>Luisenstr. 48</d:ShipAddress><d:ShipCity>Münster</d:ShipCity><d:ShipRegion m:null="true" /><d:ShipPostalCode>44087</d:ShipPostalCode><d:ShipCountry>Germany</d:ShipCountry></m:properties></content></entry>
{ name: 'CompanyName', map: 'm\\:properties>d\\:CompanyName' }
<content type="application/xml"><m:properties><d:CustomerID>ALFKI</d:CustomerID><d:CompanyName>Alfreds Futterkiste</d:CompanyName><d:ContactName>Maria Anders</d:ContactName><d:ContactTitle>Sales Representative</d:ContactTitle><d:Address>Obere Str. 57</d:Address><d:City>Berlin</d:City><d:Region m:null="true" /><d:PostalCode>12209</d:PostalCode><d:Country>Germany</d:Country><d:Phone>030-0074321</d:Phone><d:Fax>030-0076545</d:Fax></m:properties></content>
var data = [{ "empName": "test", "age": "67", "department": { "id": "1234", "name": "Sales" }, "author": "ravi"}]; // prepare the data var source = { datatype: "json", datafields: [ { name: 'empName' }, { name: 'age' }, { name: 'id', map: 'department>id' }, { name: 'name', map: 'department>name' }, { name: 'author' } ], localdata: data }; var dataAdapter = new $.jqx.dataAdapter(source);
<?xml version="1.0" encoding="utf-8" standalone="yes"?><Customers><Customer CustomerID="1" Name="Customer 1"></Customer><Customer CustomerID="2" Name="Customer 2"></Customer></Customers>
var url = "../sampledata/customers.xml";// prepare the datavar source ={datatype: "xml",datafields: [{ name: 'CustomerID', map: '[CustomerID]' },{ name: 'Name', map: '[Name]' }],root: "Customers",record: "Customer",url: url};var dataAdapter = new $.jqx.dataAdapter(source);
$("#jqxgrid").jqxGrid({width: 400,source: dataAdapter,columns: [{ text: 'ID', datafield: 'CustomerID', width: 250 },{ text: 'Name', datafield: 'Name', width: 150 }]});
var data = [ { "state": { "id": "x526", "city": { "name": "Beverly Hills", "id": 90210, "value": "Beverly Hills" } } } ]; var source = { datatype: 'json', localdata: data, datafields: [ { name: 'cityName', map: 'state>city>name' } ] }; var dataAdapter = new $.jqx.dataAdapter(source);
var employeesSource = { datatype: "xml", datafields: [ { name: 'FirstName', type: 'string' }, { name: 'LastName', type: 'string' } ], root: "Employees", record: "Employee", id: 'EmployeeID', url: "../sampledata/employees.xml", async: false }; var employeesAdapter = new $.jqx.dataAdapter(employeesSource, { autoBind: true, beforeLoadComplete: function (records) { var data = new Array(); // update the loaded records. Dynamically add EmployeeName and EmployeeID fields. for (var i = 0; i < records.length; i++) { var employee = records[i]; employee.EmployeeName = employee.FirstName + " " + employee.LastName; employee.EmployeeID = employee.uid; data.push(employee); } return data; } }); // prepare the data var ordersSource = { datatype: "xml", datafields: [ // name - determines the field's name. // value - the field's value in the data source. // values - specifies the field's values. // values.source - specifies the foreign source. The expected value is an array. // values.value - specifies the field's name in the foreign source. // values.name - specifies the field's value in the foreign source. // When the ordersAdapter is loaded, each record will have a field called "EmployeeName". The "EmployeeName" for each record comes from the employeesAdapter where the record's "EmployeeID" from orders.xml matches to the "EmployeeID" from employees.xml. { name: 'EmployeeName', value: 'EmployeeID', values: { source: employeesAdapter.records, value: 'EmployeeID', name: 'EmployeeName' } }, { name: 'EmployeeID', map: 'm\\:properties>d\\:EmployeeID' }, { name: 'ShippedDate', map: 'm\\:properties>d\\:ShippedDate', type: 'date' }, { name: 'Freight', map: 'm\\:properties>d\\:Freight', type: 'float' }, { name: 'ShipName', map: 'm\\:properties>d\\:ShipName' }, { name: 'ShipAddress', map: 'm\\:properties>d\\:ShipAddress' }, { name: 'ShipCity', map: 'm\\:properties>d\\:ShipCity' }, { name: 'ShipCountry', map: 'm\\:properties>d\\:ShipCountry' } ], root: "entry", record: "content", id: 'm\\:properties>d\\:OrderID', url: "../sampledata/orders.xml", pager: function (pagenum, pagesize, oldpagenum) { // callback called when a page or page size is changed. } }; var ordersAdapter = new $.jqx.dataAdapter(ordersSource);
pager: function (pagenum, pagesize, oldpagenum) { }
sort: function (column, direction) { }
filter: function (filters, recordsArray) { }
addrow: function (rowid, rowdata, position, commit) { // synchronize with the server - send insert command // call commit with parameter true if the synchronization with the server is successful //and with parameter false if the synchronization failed. commit(true); }
deleterow: function (rowid, commit) { // synchronize with the server - send delete command // call commit with parameter true if the synchronization with the server is successful //and with parameter false if the synchronization failed. commit(true); }
updaterow: function (rowid, newdata, commit) { // synchronize with the server - send update command // call commit with parameter true if the synchronization with the server is successful // and with parameter false if the synchronization failed. commit(true); }
var source ={datatype: "jsonp",datafields: [{ name: 'countryName' },{ name: 'name' },{ name: 'population', type: 'float' },{ name: 'continentCode' }],url: "http://ws.geonames.org/searchJSON",processdata: function (data) {data.featureClass = "P";;data.style = "full";data.maxRows = 50;}};
var source ={datatype: "jsonp",datafields: [{ name: 'countryName' },{ name: 'name' },{ name: 'population', type: 'float' },{ name: 'continentCode' }],url: "http://ws.geonames.org/searchJSON",data: {featureClass: "P",style: "full",maxRows: 50},formatdata: function (data) {return "my data";}};
var dataAdapter = new $.jqx.dataAdapter(source, {loadComplete: function (data){// data is loaded.},loadError: function (xhr, status, error){// data is not loaded.}});
var url = "../sampledata/beverages.txt"; // prepare the data var source = { datatype: "json", datafields: [ { name: 'name' }, { name: 'type' }, { name: 'calories', type: 'int' }, { name: 'totalfat' }, { name: 'protein' } ], id: 'id', url: url }; var dataAdapter = new $.jqx.dataAdapter(source); $("#jqxgrid").jqxGrid( { width: 400, source: dataAdapter, ready: function () { $("#jqxgrid").jqxGrid('hidecolumn', 'name'); }, columnsresize: true, columns: [ { text: 'Name', datafield: 'name', width: 250 }, { text: 'Beverage Type', datafield: 'type', width: 250 }, { text: 'Calories', datafield: 'calories', width: 180 }, { text: 'Total Fat', datafield: 'totalfat', width: 120 }, { text: 'Protein', datafield: 'protein', minwidth: 120 } ] });Example with 'bindingcomplete':
var url = "../sampledata/beverages.txt"; // prepare the data var source = { datatype: "json", datafields: [ { name: 'name' }, { name: 'type' }, { name: 'calories', type: 'int' }, { name: 'totalfat' }, { name: 'protein' } ], id: 'id', url: url }; var dataAdapter = new $.jqx.dataAdapter(source); $("#jqxgrid").bind('bindingcomplete', function (event) { $("#jqxgrid").jqxGrid('hidecolumn', 'name'); }); $("#jqxgrid").jqxGrid( { width: 400, source: dataAdapter, columnsresize: true, columns: [ { text: 'Name', datafield: 'name', width: 250 }, { text: 'Beverage Type', datafield: 'type', width: 250 }, { text: 'Calories', datafield: 'calories', width: 180 }, { text: 'Total Fat', datafield: 'totalfat', width: 120 }, { text: 'Protein', datafield: 'protein', minwidth: 120 } ] });
Initialize a Grid with the source
property specified.
<!DOCTYPE html><html lang="en"><head> <title id='Description'>Grid populated from Array.</title> <link rel="stylesheet" href="../../jqwidgets/styles/jqx.base.css" type="text/css" /> <script type="text/javascript" src="../../scripts/jquery-1.11.1.min.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxcore.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxbuttons.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxscrollbar.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxmenu.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxgrid.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxgrid.selection.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxdata.js"></script> <script type="text/javascript"> $(document).ready(function () { // prepare the data var data = new Array(); var generatedata = function (rowscount) { var firstNames = [ "Andrew", "Nancy", "Shelley", "Regina", "Yoshi", "Antoni", "Mayumi", "Ian", "Peter", "Lars", "Petra", "Martin", "Sven", "Elio", "Beate", "Cheryl", "Michael", "Guylene" ]; var lastNames = [ "Fuller", "Davolio", "Burke", "Murphy", "Nagase", "Saavedra", "Ohno", "Devling", "Wilson", "Peterson", "Winkler", "Bein", "Petersen", "Rossi", "Vileid", "Saylor", "Bjorn", "Nodier" ]; var productNames = [ "Black Tea", "Green Tea", "Caffe Espresso", "Doubleshot Espresso", "Caffe Latte", "White Chocolate Mocha", "Cramel Latte", "Caffe Americano", "Cappuccino", "Espresso Truffle", "Espresso con Panna", "Peppermint Mocha Twist" ]; var priceValues = [ "2.25", "1.5", "3.0", "3.3", "4.5", "3.6", "3.8", "2.5", "5.0", "1.75", "3.25", "4.0" ]; for (var i = 0; i < rowscount; i++) { var row = {}; var productindex = Math.floor(Math.random() * productNames.length); var price = parseFloat(priceValues[productindex]); var quantity = 1 + Math.round(Math.random() * 10); row["firstname"] = firstNames[Math.floor(Math.random() * firstNames.length)]; row["lastname"] = lastNames[Math.floor(Math.random() * lastNames.length)]; row["productname"] = productNames[productindex]; row["price"] = price; row["quantity"] = quantity; row["total"] = price * quantity; data[i] = row; } return data; } var source = { localdata: generatedata(50), datatype: "array" }; var dataAdapter = new $.jqx.dataAdapter(source, { downloadComplete: function (data, status, xhr) { }, loadComplete: function (data) { }, loadError: function (xhr, status, error) { } }); $("#jqxgrid").jqxGrid( { width: 670, source: dataAdapter, columns: [ { text: 'First Name', datafield: 'firstname', width: 100 }, { text: 'Last Name', datafield: 'lastname', width: 100 }, { text: 'Product', datafield: 'productname', width: 180 }, { text: 'Quantity', datafield: 'quantity', width: 80, cellsalign: 'right' }, { text: 'Unit Price', datafield: 'price', width: 90, cellsalign: 'right', cellsformat: 'c2' }, { text: 'Total', datafield: 'total', width: 100, cellsalign: 'right', cellsformat: 'c2' } ] }); // refresh Grid data. $('input').click(function () { source.localdata = generatedata(50); $("#jqxgrid").jqxGrid({ source: source }); }); }); </script><script async src="https://www.googletagmanager.com/gtag/js?id=G-2FX5PV9DNT"></script><script>window.dataLayer = window.dataLayer || [];function gtag(){dataLayer.push(arguments);}gtag('js', new Date());gtag('config', 'G-2FX5PV9DNT');</script></head><body class='default'> <div id='jqxWidget' > <div id="jqxgrid"></div> <input type="button" value="Refresh Data" /> </div></body></html>
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<feed xml:base="http://services.odata.org/Northwind/Northwind.svc/" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://www.w3.org/2005/Atom">
<title type="text">Customers</title>
<updated>2012-11-30T11:39:28Z</updated>
<link rel="self" title="Customers" href="Customers" />
<entry>
<title type="text"></title>
<updated>2012-11-30T11:39:28Z</updated>
<author>
<name />
</author>
<content type="application/xml">
<m:properties>
<d:CustomerID>ALFKI</d:CustomerID>
<d:CompanyName>Alfreds Futterkiste</d:CompanyName>
<d:ContactName>Maria Anders</d:ContactName>
<d:ContactTitle>Sales Representative</d:ContactTitle>
<d:Address>Obere Str. 57</d:Address>
<d:City>Berlin</d:City>
<d:Region m:null="true" />
<d:PostalCode>12209</d:PostalCode>
<d:Country>Germany</d:Country>
<d:Phone>030-0074321</d:Phone>
<d:Fax>030-0076545</d:Fax>
</m:properties>
</content>
</entry>
</feed>
<!DOCTYPE html><html lang="en"><head> <title id='Description'>This example shows how to create a Grid from XML data.</title> <link rel="stylesheet" href="../../jqwidgets/styles/jqx.base.css" type="text/css" /> <script type="text/javascript" src="../../scripts/jquery-1.11.1.min.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxcore.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxbuttons.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxscrollbar.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxmenu.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxgrid.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxgrid.selection.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxdata.js"></script> <script type="text/javascript"> $(document).ready(function () { var url = "customers.xml"; // prepare the data var source = { datatype: "xml", datafields: [ { name: 'CompanyName', map: 'm\\:properties>d\\:CompanyName' }, { name: 'ContactName', map: 'm\\:properties>d\\:ContactName' }, { name: 'ContactTitle', map: 'm\\:properties>d\\:ContactTitle' }, { name: 'City', map: 'm\\:properties>d\\:City' }, { name: 'PostalCode', map: 'm\\:properties>d\\:PostalCode' }, { name: 'Country', map: 'm\\:properties>d\\:Country' } ], root: "entry", record: "content", id: 'm\\:properties>d\\:CustomerID', url: url }; var dataAdapter = new $.jqx.dataAdapter(source, { downloadComplete: function (data, status, xhr) { }, loadComplete: function (data) { }, loadError: function (xhr, status, error) { } }); // Create jqxGrid $("#jqxgrid").jqxGrid( { width: 670, source: dataAdapter, columns: [ { text: 'Company Name', datafield: 'CompanyName', width: 250 }, { text: 'Contact Name', datafield: 'ContactName', width: 150 }, { text: 'Contact Title', datafield: 'ContactTitle', width: 180 }, { text: 'City', datafield: 'City', width: 120 }, { text: 'Postal Code', datafield: 'PostalCode', width: 90 }, { text: 'Country', datafield: 'Country', width: 100 } ] }); }); </script><script async src="https://www.googletagmanager.com/gtag/js?id=G-2FX5PV9DNT"></script><script>window.dataLayer = window.dataLayer || [];function gtag(){dataLayer.push(arguments);}gtag('js', new Date());gtag('config', 'G-2FX5PV9DNT');</script></head><body class='default'> <div id='jqxWidget' style="font-size: 13px; font-family: Verdana; float: left;"> <div id="jqxgrid"></div> </div></body></html>
[{ "id": "1", "name": "Hot Chocolate", "type": "Chocolate Beverage", "calories": "370", "totalfat": "16g", "protein": "14g" }, { "id": 2, "name": "Peppermint Hot Chocolate", "type": "Chocolate Beverage", "calories": "440", "totalfat": "16g", "protein": "13g"}, { "id": "3", "name": "Salted Caramel Hot Chocolate", "type": "Chocolate Beverage", "calories": "450", "totalfat": "16g", "protein": "13g"}, { "id": "4", "name": "White Hot Chocolate", "type": "Chocolate Beverage", "calories": "420", "totalfat": "16g", "protein": "12g"}, { "id": "5", "name": "Caffe Americano", "type": "Espresso Beverage", "calories": "15", "totalfat": "0g", "protein": "1g"}, { "id": "6", "name": "Caffe Latte", "type": "Espresso Beverage", "calories": "190", "totalfat": "7g", "protein": "12g"}, { "id": "7", "name": "Caffe Mocha", "type": "Espresso Beverage", "calories": "330", "totalfat": "15g", "protein": "13g"}, { "id": "8", "name": "Cappuccino", "type": "Espresso Beverage", "calories": "120", "totalfat": "4g", "protein": "8g"}, { "id": "9", "name": "Caramel Brulee Latte", "type": "Espresso Beverage", "calories": "420", "totalfat": "9g", "protein": "8g"}, { "id": "10", "name": "Caramel Macchiato", "type": "Espresso Beverage", "calories": "240", "totalfat": "11g", "protein": "10g"}, { "id": "11", "name": "Peppermint Hot Chocolate", "type": "Espresso Beverage", "calories": "440", "totalfat": "10g", "protein": "13g"}, { "id": "12", "name": "Cinnamon Dolce Latte", "type": "Espresso Beverage", "calories": "260", "totalfat": "6g", "protein": "10g"}, { "id": "13", "name": "Eggnog Latte", "type": "Espresso Beverage", "calories": "460", "totalfat": "16g", "protein": "13g"}, { "id": "14", "name": "Espresso", "type": "Espresso Beverage", "calories": "5", "totalfat": "1g", "protein": "1g"}, { "id": "15", "name": "Espresso Con Panna", "type": "Espresso Beverage", "calories": "30", "totalfat": "1g", "protein": "0g"}, { "id": "16", "name": "Espresso Macchiato", "type": "Espresso Beverage", "calories": "100", "totalfat": "1g", "protein": "0g"}, { "id": "17", "name": "Flavored Latte", "type": "Espresso Beverage", "calories": "250", "totalfat": "6g", "protein": "12g"}, { "id": "18", "name": "Gingerbread Latte", "type": "Espresso Beverage", "calories": "320", "totalfat": "13g", "protein": "12g"}, { "id": "19", "name": "White Chocolate Mocha", "type": "Espresso Beverage", "calories": "470", "totalfat": "18g", "protein": "15g"}, { "id": 20, "name": "Skinny Peppermint Mocha", "type": "Espresso Beverage", "calories": 130, "totalfat": "15g", "protein": "13g"}, { "id": "21", "name": "Skinny Flavored Latte", "type": "Espresso Beverage", "calories": "120", "totalfat": "0g", "protein": "12g"}, { "id": "22", "name": "Pumpkin Spice Latte", "type": "Espresso Beverage", "calories": "380", "totalfat": "13g", "protein": "14g"}, { "id": "23", "name": "Caffe Vanilla Frappuccino", "type": "Frappuccino Blended Beverage", "calories": "310", "totalfat": "3g", "protein": "3g"}, { "id": "24", "name": "Caffe Vanilla Frappuccino Light", "type": "Frappuccino Blended Beverage", "calories": "180", "totalfat": "0g", "protein": "3g"}, { "id": "25", "name": "Caramel Brulee Frappuccino", "type": "Frappuccino Blended Beverage", "calories": "410", "totalfat": "13g", "protein": "4g"}, { "id": "26", "name": "Caramel Brulee Frappuccino Light", "type": "Frappuccino Blended Beverage", "calories": "190", "totalfat": "0g", "protein": "3g"}, { "id": "27", "name": "Eggnog Frappuccino", "type": "Frappuccino Blended Beverage", "calories": "420", "totalfat": "18g", "protein": "7g"}, { "id": "28", "name": "Mocha Frappuccino", "type": "Frappuccino Blended Beverage", "calories": "400", "totalfat": "15g", "protein": "5g"}, { "id": "29", "name": "Tazo Green Tea Creme Frappuccino", "type": "Frappuccino Blended Beverage", "calories": "430", "totalfat": "16g", "protein": "6g"}]
<!DOCTYPE html><html lang="en"><head> <title id='Description'>Grid populated from JSON.</title> <link rel="stylesheet" href="../../jqwidgets/styles/jqx.base.css" type="text/css" /> <script type="text/javascript" src="../../scripts/jquery-1.11.1.min.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxcore.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxbuttons.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxscrollbar.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxmenu.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxgrid.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxgrid.selection.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxdata.js"></script> <script type="text/javascript"> $(document).ready(function () { var url = "beverages.txt"; // prepare the data var source = { datatype: "json", datafields: [ { name: 'name' }, { name: 'type' }, { name: 'calories' }, { name: 'totalfat' }, { name: 'protein' }, ], id: 'id', url: url }; var dataAdapter = new $.jqx.dataAdapter(source, { downloadComplete: function (data, status, xhr) { }, loadComplete: function (data) { }, loadError: function (xhr, status, error) { } }); $("#jqxgrid").jqxGrid( { width: 670, source: dataAdapter, columns: [ { text: 'Name', datafield: 'name', width: 250 }, { text: 'Beverage Type', datafield: 'type', width: 250 }, { text: 'Calories', datafield: 'calories', width: 180 }, { text: 'Total Fat', datafield: 'totalfat', width: 120 }, { text: 'Protein', datafield: 'protein', width: 120 } ] }); }); </script><script async src="https://www.googletagmanager.com/gtag/js?id=G-2FX5PV9DNT"></script><script>window.dataLayer = window.dataLayer || [];function gtag(){dataLayer.push(arguments);}gtag('js', new Date());gtag('config', 'G-2FX5PV9DNT');</script></head><body class='default'> <div id='jqxWidget' style="font-size: 13px; font-family: Verdana; float: left;"> <div id="jqxgrid"></div> </div></body></html>
<!DOCTYPE html><html lang="en"><head> <title id='Description'>This example shows how to create a Grid from Tab-delimited text also known as tab-separated values (TSV).</title> <link rel="stylesheet" href="../../jqwidgets/styles/jqx.base.css" type="text/css" /> <script type="text/javascript" src="../../scripts/jquery-1.11.1.min.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxcore.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxdata.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxbuttons.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxscrollbar.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxmenu.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxgrid.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxgrid.selection.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxgrid.columnsresize.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxlistbox.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxdropdownlist.js"></script> <script type="text/javascript"> $(document).ready(function () { // prepare the data var source = { datatype: "tab", datafields: [ { name: 'Year', type: 'int' }, { name: 'HPI', type: 'float' }, { name: 'BuildCost', type: 'float' }, { name: 'Population', type: 'float' }, { name: 'Rate', type: 'float' } ], url: 'homeprices.txt' }; var dataAdapter = new $.jqx.dataAdapter(source); $("#jqxgrid").jqxGrid( { width: 670, source: dataAdapter, columnsresize: true, columns: [ { text: 'Year', datafield: 'Year', width: 100, minwidth: 90, maxwidth: 150 }, { text: 'HPI', datafield: 'HPI', cellsformat: 'f2', width: 100 }, { text: 'Build Cost', datafield: 'BuildCost', cellsformat: 'c2', width: 180 }, { text: 'Population', datafield: 'Population', cellsformat: 'f2', width: 100 }, { text: 'Rate', datafield: 'Rate', cellsformat: 'f5', minwidth: 100 } ] }); }); </script><script async src="https://www.googletagmanager.com/gtag/js?id=G-2FX5PV9DNT"></script><script>window.dataLayer = window.dataLayer || [];function gtag(){dataLayer.push(arguments);}gtag('js', new Date());gtag('config', 'G-2FX5PV9DNT');</script></head><body class='default'> <div id='jqxWidget'> <div id="jqxgrid"></div> </div></body></html>
<!DOCTYPE html><html lang="en"><head> <title id='Description'>This example shows how to create a Grid from Tab-delimited text also known as tab-separated values (TSV).</title> <link rel="stylesheet" href="../../jqwidgets/styles/jqx.base.css" type="text/css" /> <script type="text/javascript" src="../../scripts/jquery-1.11.1.min.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxcore.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxdata.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxbuttons.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxscrollbar.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxmenu.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxgrid.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxgrid.selection.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxgrid.columnsresize.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxlistbox.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxdropdownlist.js"></script> <script type="text/javascript"> $(document).ready(function () { // prepare the data var source = { datatype: "tab", datafields: [ { name: 'Year', type: 'int' }, { name: 'HPI', type: 'float' }, { name: 'BuildCost', type: 'float' }, { name: 'Population', type: 'float' }, { name: 'Rate', type: 'float' } ], url: 'homeprices.txt' }; var dataAdapter = new $.jqx.dataAdapter(source); $("#jqxgrid").jqxGrid( { width: 670, source: dataAdapter, columnsresize: true, columns: [ { text: 'Year', datafield: 'Year', width: 100, minwidth: 90, maxwidth: 150 }, { text: 'HPI', datafield: 'HPI', cellsformat: 'f2', width: 100 }, { text: 'Build Cost', datafield: 'BuildCost', cellsformat: 'c2', width: 180 }, { text: 'Population', datafield: 'Population', cellsformat: 'f2', width: 100 }, { text: 'Rate', datafield: 'Rate', cellsformat: 'f5', minwidth: 100 } ] }); }); </script><script async src="https://www.googletagmanager.com/gtag/js?id=G-2FX5PV9DNT"></script><script>window.dataLayer = window.dataLayer || [];function gtag(){dataLayer.push(arguments);}gtag('js', new Date());gtag('config', 'G-2FX5PV9DNT');</script></head><body class='default'> <div id='jqxWidget'> <div id="jqxgrid"></div> </div></body></html>
var data = [{ "empName": "test", "age": "67", "department": { "id": "1234", "name": "Sales" }, "author": "ravi"}]; // prepare the data var source = { datatype: "json", datafields: [ { name: 'empName' }, { name: 'age' }, { name: 'id', map: 'department>id' }, { name: 'name', map: 'department>name' }, { name: 'author' } ], localdata: data }; var dataAdapter = new $.jqx.dataAdapter(source);