一. 问题描述
- 当datagrid数据加载完成后查询框的日期会被重置
- 首先确定没调用过重置查询框代码;仅发送post请求,没有重新请求页面;数据加载完后未刷新页面。
二. 问题代码
<div id="crud_datagrid_toolbar">
<div class="query-arae">
<form id="query_form" method="post" novalidate style="display:inline-block">
<div class="fast-query-condition">
<label>会议日期:</label>
<input name="confDate" class="easyui-datebox" editable="false" value="2018-03-27" style="width:120px;">
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-tip" style="width:60px;height:25px;" onclick="javascript:$('#query_form').form('load',{confDate:'2018-03-27'});">重置</a>
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-search" style="width:60px;height:25px;" onclick="queryCand()">查询</a>
</div>
</form>
</div>
</div>
<table id="crud_datagrid" toolbar="#crud_datagrid_toolbar" style="width:100%;height:500px;" title="会议室预订管理"></table>
var columns = [[
{field:'sid',title:'sid',hidden:'true'},
{field:'confroomCode',title:'confroomCode',hidden:'true'},
{field:'confroomDetailed',title:'会议室',align:'left',formatter:fontColot},
{field:'confName',title:'会议名称',width:20,align:'center'},
{field:'startTime',title:'会议时间',width:30,align:'center',formatter:formatterdate},
{field:'personUnit',title:'预订单位',width:30,align:'center'},
{field:'personName',title:'预订人',width:20,align:'center'},
{field:'phoneString',title:'联系电话',width:20,align:'center'},
{field:'confRemarks',title:'备注信息',width:30,align:'center'},
{field:'caozuo',title:'操作',width:20,align:'center', formatter:formtButton},
]];
function tables(){
$('#crud_datagrid').datagrid({
url:"${contextPath}/system/confroomplan/list",
type:"post",
columns:columns,
fit:true,
pagination:true,
rownumbers:true,
fitColumns:true,
singleSelect:true,
queryParams:{confDate:'${newDate!}'},
iconCls:'icon-search',
pageNumber:1,
onLoadSuccess:function(){
$('#crud_datagrid').datagrid("autoMergeCells", ['confroomDetailed']);
}
});
}
function fontColot(value, row, index) {
var res = '';
res = '<button class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="create('+index+')" >预订</button>' + value;
$.parser.parse();
return res;
}
三.原因
错误调用$.parser.parse(),使用原意是动态渲染easyui按钮,但是调用方式错误。