Html Grid
Set the columnmenuopening 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">
<script src="https://jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/generatedata.js"></script>
<div id='jqxWidget'>
<div id="jqxdropdownbutton">
<div style="border-color: transparent;" id="grid">
</div>
</div>
</div>
JavaScript
// prepare the data
var data = generatedata(5);
var source = {
localdata: data,
datafields: [{
name: 'available',
type: 'bool'
},
{
name: 'firstname',
type: 'string'
},
{
name: 'price',
type: 'number'
}
],
datatype: "array",
updaterow: function(rowid, rowdata) {
// synchronize with the server - send update command
}
};
var dataAdapter = new $.jqx.dataAdapter(source);
$("#grid").jqxGrid({
width: 550,
source: dataAdapter,
pageable: false,
editable: true,
autoheight: true,
columnsresize: true,
columns: [{
text: 'Available',
datafield: 'available',
columntype: 'checkbox',
width: 67
},
{
text: 'First Name',
columntype: 'textbox',
datafield: 'firstname',
width: 90
},
{
text: 'Price',
datafield: 'price',
cellsalign: 'right',
cellsformat: 'c2'
}
]
});
// initialize jqxGrid
$("#jqxdropdownbutton").jqxDropDownButton({
width: 150,
height: 30
});
$("#grid").on('rowselect', function(event) {
var args = event.args;
var row = $("#grid").jqxGrid('getrowdata', args.rowindex);
var dropDownContent = '<div style="position: relative; margin-left: 3px; margin-top: 6px;">' +
row['firstname'] + '</div>';
$("#jqxdropdownbutton").jqxDropDownButton('setContent', dropDownContent);
});
$("#grid").jqxGrid('selectrow', 0);
var onBeginEdit = false;
$("#grid").on('cellbeginedit', function(event) {
onBeginEdit = true;
});
$("#grid").on('cellendedit', function(event) {
onBeginEdit = false;
});
$('#jqxdropdownbutton').on('close', function() {
if (onBeginEdit) {
$('#jqxdropdownbutton').jqxDropDownButton('open');
}
});