index.ftl

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="pragma" content="no-cache">
<title>列表页面</title>
<#include "*/common/resources.inc.ftl">

<script type="text/javascript">
function doSearch() {
    $('#dg').datagrid('load', $("#searchForm").serializeJSON());
}

function showAddDialog(){
    var dlg = dialog({
        title: '新建',
        url: '${CONTEXT_PATH}/project/catalog/catalogDialog',
        width: '810',
        height: '438',
        buttons: dialogDefaultHandler(doSave, function() {dlg.dialog('close');})
    });
}

function showEditDialog(){
    var row = $('#dg').datagrid('getSelected');
    if (!row) {
        top.$.messager.show({title:'消息', msg:'请选择要编辑的记录'});
        return;
    }
     
    var dlg = dialog({
        title: '编辑',
        url: '${CONTEXT_PATH}/project/catalog/catalogDialog?id='+row.id,
        width: '810',
        height: '438',
        buttons: dialogDefaultHandler(doSave, function() {dlg.dialog('close');})
    });
}

function doSave() {
    if (!top.$dw.$("#fm").form('validate')) {
        return false;
    }
    
    var dc = top.$dw.$("#fm").serializeJSON();
    $.post("${CONTEXT_PATH}/project/catalog/doSave", dc, function(response){
        if (response.status<=0){
            top.$.messager.alert('错误', response.message);
        } else {
            top.$.messager.show({title:'消息', msg:response.message});
            top.$d.dialog('close');
            $("#dg").datagrid('reload');
        }
    });
}

function doDelete() {
    var row = $('#dg').datagrid('getSelected');
    if (!row) {
        top.$.messager.show({title:'消息', msg:'请选择要删除的记录'});
        return;
    }
     
    top.$.messager.confirm('确认','确认删除?',function(r){
        if (r) {
            $.post('${CONTEXT_PATH}/project/catalog/doDelete', {id:row.id}, function(response){
                top.$.messager.show({title:'消息', msg:response.message});
                $('#dg').datagrid('reload');
            });
        }
    });
}


</script>
</head>


<body>
<table id="dg" title="列表" class="easyui-datagrid"  toolbar="#toolbar" url="${CONTEXT_PATH}/project/catalog/dgData" data-options="onDblClickRow:showEditDialog,checkOnSelect:false,selectOnCheck:false,toolbar:'#toolbarUser',onLoadSuccess:enableDndUser">
    <thead>
        <tr>
        	<!-- <th field="id" width="10" >id</th> -->
            <th field="name" width="20" >栏目名称</th>
            <th field="addUserName" width="10" >添加用户</th>
            <th field="addTime" width="10" >添加时间</th>
        </tr>
    </thead>
</table>
 
</body>
</html>


<div id="toolbar">
    <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="l-btn-icon icon-add" plain="true" onclick="showAddDialog()">新建栏目</a>
    <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="l-btn-icon icon-edit" plain="true" onclick="showEditDialog()">编辑栏目</a>
    <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="l-btn-icon icon-remove" plain="true" onclick="doDelete()">删除栏目</a>
    
	<form id="searchForm" style="float:right; margin-right:20px;">
		<input name="keyword" class="easyui-searchbox" data-options="prompt:'请输入栏目名称',searcher:doSearch" style="width:180px" />
	</form>
</div>

转载于:https://my.oschina.net/venju/blog/1929361

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值