JQuery Grid
Invoke the begincelledit method 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">
<script src="https://jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/generatedata.js"></script>
<div id='jqxWidget'>
<div id="jqxgrid"></div>
</div>
<input type="button" style="margin: 10px;" id="jqxbutton" value="Edit the first cell " />
JavaScript
var data = generatedata(500);
var source = {
localdata: data,
datafields: [{
name: 'firstname',
type: 'string'
}, {
name: 'lastname',
type: 'string'
}, {
name: 'productname',
type: 'string'
}, {
name: 'date',
type: 'date'
}, {
name: 'quantity',
type: 'number'
}, {
name: 'price',
type: 'number'
}],
datatype: "array"
};
var adapter = new $.jqx.dataAdapter(source);
$("#jqxgrid").jqxGrid({
width: 500,
theme: 'energyblue',
source: adapter,
sortable: true,
editable: true,
columns: [{
text: 'First Name',
datafield: 'firstname',
columngroup: 'Name',
}, {
text: 'Last Name',
columngroup: 'Name',
datafield: 'lastname',
}, {
text: 'Product',
datafield: 'productname',
}, {
text: 'Order Date',
datafield: 'date',
columntype: 'datetimeinput',
cellsformat: 'dd-MMMM-yyyy',
initeditor: function (row, cellvalue, editor) {
editor.jqxDateTimeInput('open');
}
}, {
text: 'Quantity',
datafield: 'quantity',
cellsalign: 'right'
}, {
text: 'Unit Price',
datafield: 'price',
cellsalign: 'right',
cellsformat: 'c2'
}],
});
$("#jqxbutton").jqxButton({
theme: 'energyblue',
height: 30
});
$('#jqxbutton').click(function() {
});
$("#jqxgrid").on('cellvaluechanged', function(event) {
var args = event.args;
var dataField = args.datafield;
var rowBoundIndex = args.rowindex;
if (dataField === 'productname') {
$("#jqxgrid").jqxGrid('begincelledit', rowBoundIndex, "date");
}
});