jQuery EasyUI DataGrid Filter Row showColumn hideColumn
HTML
<div class="easyui-panel" style="width:90%; height:350px; padding:6px;">
<div class="easyui-layout" data-options="fit:true">
<div data-options="region:'center', border:false">
<table id="dg"></table>
</div>
</div>
</div>
CSS
</style> <link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/default/easyui.css"> <link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/icon.css"> <link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/demo/demo.css"> <script type="text/javascript" src="http://code.jquery.com/jquery-1.11.3.js"></script> <script type="text/javascript" src="http://www.jeasyui.com/easyui/jquery.easyui.min.js"></script> <script type="text/javascript" src="http://www.jeasyui.com/easyui/jquery.edatagrid.js"></script> <script type="text/javascript" src="http://www.jeasyui.com/easyui/datagrid-filter.js"></script> <style>
JavaScript
$(function() {
var dg = $('#dg').edatagrid();
dg.edatagrid({
title: "Test DataGrid",
fit: true,
pagination: true,
singleSelect: true,
striped: true,
rownumbers: true,
fitColumns: false,
data: data,
columns: [[
{field: 'productid', width: 100, title: 'Product',
editor: { type: 'textbox' }
},
{field: 'listprice', width: 100, align: 'right', title: 'List Price',
editor: { type: 'combobox' }
},
{field: 'status', width: 100, align: 'center', title: 'Status' }
]]
});
dg.datagrid('getPager').pagination({
buttons: [{
iconCls: 'icon-add',
handler: function() {
alert('add new row ...');
}
}, {
iconCls: 'icon-save',
handler: function() {
alert('save changes ...');
}
}, '-', {
iconCls: 'icon-cancel',
handler: function() {
alert('cancel editing ...');
$('#dg').edatagrid('cancelRow');
}
}],
});
});
var data = [{
"productid": "FI-SW-01",
"productname": "Koi",
"unitcost": 10.00,
"status": "P",
"listprice": 36.50,
"attr1": "Large",
"itemid": "EST-1"
}, {
"productid": "AV-CB-01",
"productname": "Amazon Parrot",
"unitcost": 92.00,
"status": "N",
"listprice": 63.50,
"attr1": "Adult Male",
"itemid": "EST-18"
}];