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串为空时,显示上一次数据的解决方法的更多相关文章

  1. vc2008中mfc菜单、控件等汉字显示为问号或乱码的解决方法

    在vc2008中建立基于mfc的project.在向导的Application type页面中如果在resource language选项中选择"英语(美国)"(图一),那么在pr ...

  2. 为javasript中对象与json串之间转换的总结。

    jQuery.json 是 jQuery 的一个插件,可轻松实现对象和 JSON 字符串之间的转换.可序列化 JavaScript 对象.数值.字符串和数组到 JSON 字符串,同时可转换 JSON ...

  3. WPF中DataGrid中的DataGridCheckBoxColumn用法(全选,全否,反选)

    原文:WPF中DataGrid中的DataGridCheckBoxColumn用法(全选,全否,反选) 前台代码 <DataGrid.Columns> <DataGridCheckB ...

  4. WPF学习笔记(8):DataGrid单元格数字为空时避免验证问题的解决

    原文:WPF学习笔记(8):DataGrid单元格数字为空时避免验证问题的解决 如下图,在凭证编辑窗体中,有的单元格不需要数字,但如果录入数字后再删除,会触发数字验证,单元格显示红色框线,导致不能执行 ...

  5. WPF:指定的命名连接在配置中找不到、非计划用于 EntityClient 提供程序或者无效的解决方法

    文/嶽永鹏 WPF 数据绑定中绑定到ENTITY,如果把数据文件做成一个类库,在UI文件中去应用它,可能遇到下面这种情况. 指定的命名连接在配置中找不到.非计划用于 EntityClient 提供程序 ...

  6. zend studio中ctrl+鼠标左键无法转到类或函数定义文件的解决方法

    转载自:http://blog.csdn.net/wide288/article/details/21622183 zend studio中ctrl+鼠标左键无法转到类或函数定义文件的解决方法: ze ...

  7. ExtJs4.2中Tab选项卡的右击关闭其它和关闭当前功能不准确的解决方法

    一.ExtJs4.2中Tab选项卡的右击关闭其它和关闭当前功能不准确的解决方法 二.找到ux目录下的TabCloseMenu.js文件,将内容替换成下面代码. 三.代码: /** * Plugin f ...

  8. resultMap中的collection集合出现只能读取一条数据的解决方法

    查询数据时只能获得collection集合中的的一条数据,相关情况如下: 结果集resultMap: <resultMap id="ManagerRolesAcls" typ ...

  9. Repeater为空时显示“暂无数据”,很方便实用方法

    Repeater为空时显示“暂无数据”,很方便实用方法 <FooterTemplate>   <asp:Label ID="lblEmptyZP" Text=&q ...

随机推荐

  1. Security Tools (Contain CTF tools)

    From now on I will start to have fun with CTF and other security games or challenges. And I am going ...

  2. sobel算子原理及opencv源码实现

    sobel算子原理及opencv源码实现 简要描述 sobel算子主要用于获得数字图像的一阶梯度,常见的应用和物理意义是边缘检测. 原理 算子使用两个33的矩阵(图1)算子使用两个33的矩阵(图1)去 ...

  3. UVa10820 Send a Table[欧拉函数]

    Send a TableInput: Standard Input Output: Standard Output When participating in programming contests ...

  4. 第9章 用内核对象进行线程同步(4)_死锁(DeadLock)及其他

    9.7 线程同步对象速查表 对象 何时处于未触发状态 何时处于触发状态 成功等待的副作用 进程 进程仍在运行的时候 进程终止的时(ExitProcess.TerminateProcess) 没有 线程 ...

  5. VS的快捷键F12改成和ECLIPSE一样用ctrl+点击下载线

    安装resharper 插件即可 不过这个插件是收费的,可免费体验30天

  6. java 22 - 5 多线程之获取和设置线程对象的名称

    如何获取线程对象的名称呢? public final String getName():获取线程的名称.如何设置线程对象的名称呢? public final void setName(String n ...

  7. UITableViewCell 多选和全选(checkBoxCell)

    思路1 一.全选 1.创建可变数组,存储所有未选中状态(NO)的布尔值按钮,点击时改变其状态,并传入按钮的状态. 二.多选 1.创建Cell时,从数组中取出相应的值,传给cell,如果为YES,否则为 ...

  8. LazyInitializationException: could not initialize proxy no session

    这完全是框架设计者的锅,讲道理  无论是SSH SSM都太重了, Hibernate几乎把SQL完全封装了一遍,简单的一对多关系,如果开启LazyLoad 这样实体类会被代理,直到访问这个多方实体的属 ...

  9. windows Server 2008各版本区别详解

    Windows Server 2008 是专为强化下一代网络.应用程序和 Web 服务的功能而设计,是有史以来最先进的 Windows Server 操作系统.拥有 Windows Server 20 ...

  10. linux传输大文件

    http://dreamway.blog.51cto.com/1281816/1151886 linux传输大文件