标签:
function initSearchProject(startDate,finishDate,flag) {
$("#finishDate").val(finishDate);
$("#startDate").val(startDate);
var reflag=$(‘#reflag‘).val(flag);
$(‘#dg‘).datagrid({
queryParams : {
‘startDate‘:startDate,
‘finishDate‘:finishDate,
‘flag‘:flag
},
url : ‘getWcUserPerformanceAction.do‘,
singleselect:‘true‘,
columns : [ [
{
field : ‘performanceDate1‘,
title : ‘日期‘,
width : 120
},
{
field : ‘userName‘,
title : ‘姓名‘,
width : 120
},
{
field : ‘loginTime1‘,
title : ‘登录时间‘,
width : 120
},
{
field: ‘endTime1‘,
title : ‘登出时间‘,
width : 120
},
{
field : ‘weiboDistributeCount‘,
title : ‘分配量‘,
width : 120
},
{
field : ‘weiboDealCount‘,
title : ‘处理量‘,
width : 120
},
{
field : ‘weiboResponseSpeed1‘,
title : ‘均响应时间‘,
width : 120
},
{
field : ‘onlineTimea‘,
title : ‘总登录时长‘,
width : 120
},
{
field : ‘personRate‘,
title : ‘人员利用率‘,
width : 80
}
] ]
});
}
页面上部不变,当查询条件改变时,在调用此方法。
<a id="d1" #if(reflag=="1") class="active" #end href="javascript:initSearchProject(‘‘,‘‘,‘1‘);" class="sel_a">昨天</a>
<script>
$(document).ready(function (e) {
var dates = $("#startDate,#finishDate");
dates.datepicker({
maxDate: new Date(),
dateFormat:"yy-mm-dd",
onSelect: function(selectedDate){
if(this.id=="startDate"){
var startDate = "";
var finishDate = "";
var flag="";
if(flag == ""){//用选择的日期查
flag = 0;
startDate = $("#startDate").val();
if(startDate == ""){
return;
}
//调整时间,开始时间选择,结束时间自动为7天后
//start1 = start.replace(/-/g,"/");
var d = new Date(startDate);
d.setDate(d.getDate() + 6);
var year = d.getFullYear();
var month = d.getMonth()+1;
var day = d.getDate();
if(month<10){
month = "0"+month;
}
if(day<10){
day = "0"+day;
}
var time=year+"-"+month+"-"+day;
$("#finishDate").val(year+"-"+month+"-"+day);
//
finishDate = $("#finishDate").val();
if(startDate == "" || finishDate == ""){
return;
}
}
alert("flag-startDate-finishDate:"+flag+startDate+finishDate);
initSearchProject(startDate,finishDate,flag);
}
else
{
var rg="1";
var t="1";
var startDate = $("#startDate").val();
var finishDate = $("#finishDate").val();
if(startDate == "" || finishDate == ""){
return;
}
//start = start1.replace(/-/g,"/");
//end = end1.replace(/-/g,"/");
var d1 = new Date(startDate);
var d2 = new Date(finishDate);
if(d1>d2){
alert("结束时间不能小于开始时间!");
return;
}
$("#finishDate").val();
$("#startDate").val();
var flag = 0;
if(startDate == "" && finishDate == ""){
flag = fg;
}
initSearchProject(startDate,finishDate,flag);
}
}
});
});
</script>
这时候查询结果为null,那么datagrid的值为上次非null的数据。
修改方法:在action中加判断条件,当list为空时,重新new一个list
if(wbList==null){
wbList=new ArrayList<WcUserPerformanceDto>();
}
这样后list为{},而不是null。
从而esayui接收其数据。
esayUi中datagrid中json串为空时,显示上一次数据的解决方法
标签:
原文地址:http://www.cnblogs.com/yangfei-beijing/p/4318706.html