jQuery Grid

Set the altrows property of the jqxGrid. Author: http://jqwidgets.com

HTML

<script src="https://jqwidgets.com/public/jqwidgets/jqx-all.js"></script>
<link rel="stylesheet" href="https://jqwidgets.com/public/jqwidgets/styles/jqx.base.css">
<link rel="stylesheet" href="https://jqwidgets.com/public/jqwidgets/styles/jqx.energyblue.css">
<div id='jqxWidget'>
  <div id="grid"></div>
  <div style="margin-top: 30px;">
    <div id="cellbegineditevent"></div>
    <div style="margin-top: 10px;" id="cellendeditevent"></div>
  </div>
  <div id="popupWindow">
    <div>Edit</div>
    <div style="overflow: hidden;">
      <table>
        <tr>
          <td align="right">First Name:</td>
          <td align="left"><input id="firstName" /></td>
        </tr>
        <tr>
          <td align="right">Last Name:</td>
          <td align="left"><input id="lastName" /></td>
        </tr>
        <tr>
          <td align="right">Product:</td>
          <td align="left"><input id="product" /></td>
        </tr>
        <tr>
          <td align="right">Quantity:</td>
          <td align="left">
            <div id="quantity"></div>
          </td>
        </tr>
        <tr>
          <td align="right">Price:</td>
          <td align="left">
            <div id="price"></div>
          </td>
        </tr>
        <tr>
          <td align="right"></td>
          <td style="padding-top: 10px;" align="right"><input style="margin-right: 5px;" type="button" id="Save" value="Save" /><input id="Cancel" type="button" value="Cancel" /></td>
        </tr>
      </table>
    </div>
  </div>
  <div id='Menu'>
    <ul>
      <li>Edit Selected Row</li>
      <li>Delete Selected Row</li>
    </ul>
  </div>
</div>

JavaScript

const theme = 'energyblue'
  var data = new Array();
  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 < 100; 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;
  }
  var source = {
    localdata: data,
    datatype: "array"
  };
  // initialize the input fields.
  $("#firstName").addClass('jqx-input');
  $("#lastName").addClass('jqx-input');
  $("#product").addClass('jqx-input');
  $("#firstName").width(250);
  $("#firstName").height(30);
  $("#lastName").width(250);
  $("#lastName").height(30);
  $("#product").width(250);
  $("#product").height(30);
  if (theme.length > 0) {
    $("#firstName").addClass('jqx-input-' + theme);
    $("#lastName").addClass('jqx-input-' + theme);
    $("#product").addClass('jqx-input-' + theme);
  }
 ...