<script type="text/javascript">
var tb = $("#table_sitelinklist")
tb.datagrid({
url: '/Manage/SiteLinkList/',
border:false,
fit: true,
//singleSelect:true,
pagination: true,
pagePosition:'top',
nowrap: true,
striped: true,
pageList: [5,10, 15, 20, 25],
pageSize: 20,
pageNumber:@(ViewBag.page),
idField:"ID",
//queryParams: { status: _status },
columns: [[
{ checkbox: true },
{ field: 'ID', hidden: true},
{ field: 'Name', title: '链接站点名称', width: 200, sortable: true,
formatter: function (value, rec) {
return "<a href='javascript:void(0)' title='点击编辑此链接信息' class='_sitelink_" + rec.ID + "'>" + value + "</a>"
}
},
{ field: 'URL', title: '链接地址', width: 340, sortable: true },
{ field: 'Type', title: '分类', width: 120, sortable: true },
{ field: 'SName', title: '简称', width: 120, sortable: true },
{ field: 'ShowOrder', title: '显示顺序', width: 120, sortable: true }
]],
onLoadSuccess: function () { AddEditable("sitelink","/Manage/SiteLinkEdit/") }
})
var btns=[
{ iconCls: 'icon-edit',text: '添加', handler: function () { AddNewObject("添加新链接","/Manage/SiteLinkEdit/?operation=1")} },
{ iconCls: 'icon-myrealdel',text: '删除', handler: function () { SendModifyRequest("del","删除","table_sitelinklist","/Manage/SiteLinkListModify") } }
]
tb.datagrid('getPager').pagination({buttons:btns})
</script>
给个示例代码给你吧。
说明一下,这个示例代码中,可以通过点击某一行的链接名称进行编辑,每一行的前面有选择框,可以选择多个。将分页工具栏放到了表格顶端,并添加了两个按钮(添加、删除),删除功能支持批量 *** 作。AddEditable、AddNewObject、SendModifyRequest是自定义的js function,这里并没有附上。
参考下面代码:<div id="gpyDiv" class="easyui-layout" fit=true style="width:100%height:100%">
<div data-options="region:'south',title:'South Title',split:true" style="height:100px"></div>
<div data-options="region:'east',iconCls:'icon-reload',title:'East',split:true" style="width:100px"></div>
<div data-options="region:'west',title:'West',split:true" style="width:100px"></div>
<div data-options="region:'center',title:'center title'" style="padding:5pxbackground:#eee"></div>
</div>
<a href="JavaScript:void(0)" class="easyui-linkbutton" value="Scan" id="BtnScan" data-options="iconCls:'icon-print'" onclick="javascript:addPanel()" >添加面板</a>
<a href="javascript:void(0)" class="easyui-linkbutton" value="Scan" id="BtnScan" data-options="iconCls:'icon-print'" onclick="javascript:deletePanel()" >删除面板</a>
/*添加div*/
function addPanel(){
$("#gpyDiv").layout('add',{
region: 'south',
width: '100%',
height:200
})
}
/*删除div*/
function deletePanel(){
$("#gpyDiv").layout('remove','south')
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)