toggleCol: function (columnparm, visible) {
grid.columnparm.display["用戶編碼"].visible = false;
}, 這是我寫的代碼 ,我剛學這個不懂,求各位大神指導啊。
隱藏,顯示列?你看下官方demo,http://www.ligerui.com/
<title></title>
<link href="../../../lib/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css">
<script src="../../../lib/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="../../../lib/ligerUI/js/core/base.js" type="text/javascript"></script>
<script src="../../../lib/ligerUI/js/plugins/ligerGrid.js" type="text/javascript"></script>
<script src="../../../lib/ligerUI/js/plugins/ligerResizable.js" type="text/javascript"></script>
<script src="../CustomersData.js" type="text/javascript"></script>
<script type="text/javascript">
var g;
$(function () {
g = $("#maingrid4").ligerGrid({
columns: [
{ display: '主鍵', name: 'CustomerID', align: 'left', width: 120 },
{ display: '公司名', name: 'CompanyName', minWidth: 60 },
{
display: '城市', name: 'City', id: 'City1',
totalSummary:
{
type: 'count'
}
}, { display: '城市', name: 'City' },
{ display: '聯系名', name: 'ContactName', width: 50, align: 'left' }
], pageSize:10,
data: CustomersData,
width: '100%',height:'100%',allowHideColumn:false
});
$("#pageloading").hide();
});
function f_hideCity()
{
g.toggleCol('City1', false);
}
function f_showCity()
{
g.toggleCol('City1', true);
}
</script>
<input type="button" onclick="f_hideCity()" value="隱藏列">
<input type="button" onclick="f_showCity()" value="顯示列">
<div id="maingrid4" style="margin:0; padding:0"></div>
<div style="display:none;">
<!-- g data total ttt -->
</div>