JQuery Grid
Invoke the updaterow method of the jqxGrid.
Author: http://jqwidgets.com
by Manu Vashishtha
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">
<script src="https://jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/generatedata.js"></script>
<div id='jqxWidget'>
<div id="jqxgrid"></div>
</div>
<div style="margin-top: 10px;">
<input id="updaterowbutton" type="button" value="Update Selected Row" />
</div>
JavaScript
var data = generatedata(500);
var source = {
localdata: data,
datafields: [{
name: 'firstname',
type: 'string',
map:'firstname'
}, {
name: 'lastname',
type: 'string',
map:'lastname'
}, {
name: 'productname',
type: 'string',
map:'productname'
}, {
name: 'date',
type: 'date',
map:'date'
}, {
name: 'quantity',
type: 'number',
map:'quantity'
}, {
name: 'price',
type: 'number',
map:'price'
}],
datatype: "array"
};
var adapter = new $.jqx.dataAdapter(source);
$("#jqxgrid").jqxGrid({
width: 600,
theme: 'energyblue',
source: adapter,
sortable: true,
editable:true,
ready: function () {
$("#jqxgrid").jqxGrid('selectrow', 0);
},
columns: [{
text: 'First Name',
datafield: 'firstname',
width: 90
}, {
text: 'Last Name',
datafield: 'lastname',
width: 90
}, {
text: 'Product',
datafield: 'productname',
width: 170
}, {
text: 'Order Date',
datafield: 'date',
width: 160,
cellsformat: 'dd/MM/yyyy',
columntype:"datetimeinput"
}, {
text: 'Quantity',
datafield: 'quantity',
width: 80,
cellsalign: 'right'
}, {
text: 'Unit Price',
datafield: 'price',
cellsalign: 'right',
cellsformat: 'c2'
}],
});
$("#updaterowbutton").jqxButton({
theme: 'energyblue',
height: 30
});
$("#updaterowbutton").on('click', function () {
//var _temp=generatedata(1)[0];
var datarow = {available: true,date: '10/09/2018',firstname: "Beate",id: 0,lastname: "Petersen",name: "Beate Petersen",price: 5,productname: "Cappuccino",quantity: 7,total: 35 };
var selectedrowindex =...