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',
styler: function(value,row,index) {
if (row.isEditing){return '';}
if(value == 'P') {
return "background:url('http://www.jeasyui.com/easyui/themes/icons/ok.png') no-repeat center;";
}
else {
return "background:url('http://www.jeasyui.com/easyui/themes/icons/cancel.png') no-repeat center;";
}
},
formatter: function() { return ''; },
editor: { type: 'checkbox',options:{on:'P',off:'N'} }
}
]],
onBeforeEdit: function(index,row){
row.isEditing = true;
$(this).datagrid('refreshRow', index);
row.isEditing = false;
}
});
dg.datagrid('getPager').pagination({
buttons: [{
id: 'btn-add',
iconCls: 'icon-add',
handler: function() {
//alert('add new row ...');
}
}, {
id: 'btn-save',
iconCls: 'icon-save',
handler: function() {
//alert('save changes ...');
}
}, '-', {
id: 'btn-cancel',
iconCls: 'icon-cancel',
handler: function() {
//alert('cancel editing ...');
$('#dg').edatagrid('cancelRow');
}
}],
});
$('#btn-add').attr('title', 'Add');
$('#btn-save').attr('title', 'Save');
$('#btn-cancel').attr('title', 'Cancel');
});
var data = [{
"productid": "FI-SW-01",
"productname": "Koi",
"unitcost": 10.00,
"status": "P",
"listprice": 36.50,
"attr1": "Large",
"itemid":...