JSFiddle - React, Tailwind, and code Playground

by dpetrov

HTML

<script src="http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/generatedata.js"></script>
<script src="http://jqwidgets.com/public/jqwidgets/jqx-all.js"></script>
<link rel="stylesheet" href="http://jqwidgets.com/public/jqwidgets/styles/jqx.base.css">
<link rel="stylesheet" href="http://jqwidgets.com/public/jqwidgets/styles/jqx.energyblue.css">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<div id='jqxWidget' style="font-size: 13px; font-family: Verdana;">

    <div id="jqxgrid"></div>
</div>

JavaScript

var data = generatedata(200);
  var source = {
      localdata: data,
      datatype: "array",
      datafields: [{
          name: 'firstname',
          type: 'string'
      }, {
          name: 'lastname',
          type: 'string'
      }, {
          name: 'productname',
          type: 'string'
      }, {
          name: 'available',
          type: 'bool'
      }, {
          name: 'quantity',
          type: 'number'
      }, {
          name: 'price',
          type: 'number'
      }],
      updaterow: function (rowid, rowdata) {
          // synchronize with the server - send update command   
      }
  };
  var dataAdapter = new $.jqx.dataAdapter(source);
  // initialize jqxGrid
  $("#jqxgrid").jqxGrid({
      width: '100%',
      height: 400,
      source: dataAdapter,
      theme: 'energyblue',
      editable: true,
      selectionmode: 'checkbox',
      columns: [{
          text: 'First Name',
          columntype: 'textbox',
          datafield: 'firstname',
          width: 120
      }, {
          text: 'Last Name',
          datafield: 'lastname',
          columntype: 'textbox',
          width: 120
      }, {
          text: 'Product',
          datafield: 'productname',
          width: 200,

      }, {
          text: 'In Stock',
          datafield: 'available',
          columntype: 'checkbox',
          width: 200,

      }, {
          text: 'Quantity',
          datafield: 'quantity',
          width: 150,
          cellsalign: 'right',
          cellsformat: 'n2',
          aggregates: ['min', 'max'],

      }, {
          text: 'Price',
          datafield: 'price',
          cellsalign: 'right',
          cellsformat: 'c2',
          width: 100
      }]
  });

$('#jqxgrid').on('rowselect', function (event) {
     // event.args.rowindex is a bound index.
    alert("Row with bound index: " + event.args.rowindex +" has been selected.\n Currently selected rows: " +  $("#jqxgrid").jqxGrid('selectedrowindexes'));
...