JSFiddle - React, Tailwind, and code Playground
by nija das
HTML
<script src="http://www.jqwidgets.com/public/jqwidgets/jqxcore.js"></script>
<script src="http://www.jqwidgets.com/public/jqwidgets/jqxdata.js"></script>
<script src="http://www.jqwidgets.com/public/jqwidgets/jqxbuttons.js"></script>
<script src="http://www.jqwidgets.com/public/jqwidgets/jqxscrollbar.js"></script>
<script src="http://www.jqwidgets.com/public/jqwidgets/jqxmenu.js"></script>
<script src="http://www.jqwidgets.com/public/jqwidgets/jqxgrid.js"></script>
<script src="http://www.jqwidgets.com/public/jqwidgets/jqxgrid.sort.js "></script>
<script src="http://www.jqwidgets.com/public/jqwidgets/jqxgrid.filter.js"></script>
<script src="http://www.jqwidgets.com/public/jqwidgets/jqxgrid.selection.js"></script>
<script src="http://www.jqwidgets.com/public/jqwidgets/jqxpanel.js"></script>
<script src="http://www.jqwidgets.com/public/jqwidgets/jqxcheckbox.js"></script>
<script src="http://www.jqwidgets.com/public/jqwidgets/jqxlistbox.js"></script>
<script src="http://www.jqwidgets.com/public/jqwidgets/jqxdropdownlist.js"></script>
<body class='default'>
<div id='jqxWidget' style="font-size: 13px; font-family: Verdana; float: left;">
<div id="jqxgrid">
</div>
<div id="eventslog" style="margin-top: 30px;">
<div style="float: left; margin-right: 10px;">
<input value="Remove Sort" id="clearsortingbutton" type="button" />
<div style="margin-top: 10px;" id='sortbackground'>Sort Background</div>
</div>
<div style="margin-left: 100px; float: left;">
Event Log:
<div style="border: none;" id="events">
</div>
</div>
</div>
</div>
</body>
JavaScript
var url = "../sampledata/orders.xml";
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', type: 'string' },
{ name: 'ShipAddress', map: 'm\\:properties>d\\:ShipAddress', type: 'string' },
{ name: 'ShipCity', map: 'm\\:properties>d\\:ShipCity', type: 'string' },
{ name: 'ShipCountry', map: 'm\\:properties>d\\:ShipCountry', type: 'string' }
],
root: "entry",
record: "content",
id: { name: "OrderID", map: "m\\:properties>d\\:OrderID" },
url: url,
sortcolumn: 'ShipName',
sortdirection: 'asc'
};
var dataAdapter = new $.jqx.dataAdapter(source);
// create jqxgrid.
$("#jqxgrid").jqxGrid(
{
width: 850,
height: 450,
source: dataAdapter,
sortable: true,
filterable: true,
altrows: true,
columns: [
{ text: 'Ship Name', datafield: 'ShipName', width: 250 },
{ text: 'Shipped Date', datafield: 'ShippedDate', width: 100, cellsformat: 'yyyy-MM-dd' },
{ text: 'Freight', datafield: 'Freight', width: 80, cellsformat: 'F2', cellsalign: 'right' },
{ text: 'Ship Address', datafield: 'ShipAddress', width: 350 },
{ text: 'Ship City', datafield: 'ShipCity', width: 100 },
{ text: 'Ship Country', datafield: 'ShipCountry', width: 101 }
]
});
$('#events').jqxPanel({ width: 300, height: 80});
...