easyui 日期范围前后台的设置以及实现

1.页面部分(引入相应的js)

<td class="w40 tl pl10">从日期:</td>
            <td>
                <input class="easyui-datebox stdfrm-b2" name="mDateBegin" id="mDateBegin" style="width: 158px;" data-options="validType:‘date‘,height:23"></input>
            </td>
            <td class="w40 tl pl10">到日期:</td>
            <td>
                <input class="easyui-datebox stdfrm-b2" name="mDateEnd" id="mDateEnd" style="width: 158px;" data-options="validType:‘date‘,height:23"></input>
            </td>

<span style="float:left;margin-left:80px;margin-top:12px;"><a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:‘icon-fi-search‘" style="width:80px" onclick="doQuery();">查询</a></span>

2.js

/**
 * 查询
 */
function doQuery(){
    $(‘#dg_menu‘).datagrid(‘reload‘,{
        ‘mDateBegin‘: $(‘#mDateBegin‘).datebox(‘getValue‘),
        ‘mDateEnd‘: $(‘#mDateEnd‘).datebox(‘getValue‘),
        ‘code‘: $(‘#mealtime‘).combobox(‘getValue‘)
    });
}

3.后台

public String queryMenu() throws Exception{
        HttpServletRequest request = this.getRequest();
        String mDateBegin = request.getParameter("mDateBegin");
        String mDateEnd = request.getParameter("mDateEnd");
        String type = request.getParameter("code");
        if("请选择".equals(type)){
            type = null;
        }
        if(conditions == null){
            conditions = new ArrayList();
        }
        if(mDateBegin != null && !mDateBegin.equals("")){
            Condition c1 = new Condition();
            c1.setPropertyKey("mDate");
            c1.setPropertyExpression(">=");
            c1.setPropertyValue(mDateBegin);
            conditions.add(c1);
        }

        if(mDateEnd != null && !mDateEnd.equals("")){
            Condition c2 = new Condition();
            c2.setPropertyKey("mDate");
            c2.setPropertyExpression("<=");
            c2.setPropertyValue(mDateEnd);
            conditions.add(c2);
        }

        if(type != null && !type.equals("")){
            Condition c3 = new Condition();
            c3.setPropertyKey("mealtime");
            c3.setPropertyExpression("=");
            c3.setPropertyValue(type);
            conditions.add(c3);
        }
        Map map = (Map) this.menuService.queryMenu(conditions, pager, sorter);
        jsonConfig.registerJsonValueProcessor(Date.class,new JsonDateValueProcessor());
        this.utf8ResponseWriter().write(
                JSONObject.fromObject(map, jsonConfig).toString());
        return null;
    }

以上代码不是完整,

待续……

时间: 2024-08-22 03:07:29

easyui 日期范围前后台的设置以及实现的相关文章

easyui日期在未加载easyui-lang-zh_CN.js出现英文的情况下加载中文的方法

我们有时候在操作easyui的时候本来是加载了easyui-lang-zh_CN.js中文文件包,但是还是出现了英文.使得我们不得埋怨这框架咋这么不好用,其实我们仔细看看这个中文包就会发现里面很多都是重新修改了定义语言的参数.假如我们用jquery初始化加载方法$(function(){//这里是我们自定义的操作方法});这个方法里面的东西执行后发现更本没加载我们的中文下面是我写的datetimebox日期控件js代码: $(function () { function adddaytimes(

Eclipse自动补全功能和自动生成作者、日期注释等功能设置

以前想实现添加代码作者信息的东西,但不知道怎样实现,今天终于在网上无意中找到解决办法了 Eclipse自动生成作者.日期注释等功能设置 在使用Eclipse 编写Java代码时,自动生成的注释信息都是按照预先设置好的格式生成的. 修改作者.日期注释格式:打开Windows->Preferences->Java->Code Style->Code Templates,点击右边窗口中的Comments,可以看到有很多选项,我们便可对此注释信息模板进行编辑. 如我们希望在一个Java文件

easyui 自定义验证,动态设置提示信息

//自定义验证规则 名称为name //$.fn.validatebox.defaults.rules.name.message 动态自定义提示内容 $.extend($.fn.validatebox.defaults.rules, { name: { validator: function (value, param) { var error=false;; if(!/^\S{4,25}$/.test(value)){ //4-25验证 $.fn.validatebox.defaults.ru

java_Eclipse自动生成作者、日期注释等功能设置_导入 xml方式

常规方式 随便百度个 类比 http://blog.sina.com.cn/s/blog_4080505a0101guoh.html 这里主要介绍配好后,导出,xml,迁移环境时 导入 comment 和code同时选中 ,导出用export ,导入用import 我自己用的: codetemplates.xml <?xml version="1.0" encoding="UTF-8" standalone="no"?><tem

JQuery EasyUI 日期控件 怎样做到只显示年月,而不显示日

标题问题的答案在OSChina中 http://www.oschina.net/question/2282354_224401?fromerr=lHJTcN89 我还是把这个记录下来 ================================================================= <input id="dlgReleaseTime" class="easyui-datebox"></input> $('#dl

EasyUI 日期选择插件封装成选择到月份的插件

将普通的日期选择插件封装成选择到月份的插件:                     var nowMonth = new Date();                    var month = nowMonth.getMonth()+1;                    month = month < 10 ?"0"+month:month;                    var fmdate =nowMonth.getFullYear()+"-&

Jackson JSON对日期格式的解析设置

服务器端:采用Spring MVC3 + MyBatis3架构设计,使用Jackson JSON将Java对象转换成JSON格式: Spring:3.2.2.RELEASE MyBatis:3.2.1 mybatis-spring:1.2.0 前端:采用jQuery EasyUI框架,使用 jquery-json-2.4.js 将javascript对象转换成JSON格式: 交互方式:服务器端和前端采用json格式进行数据交互. 遇到问题:服务器端对Java对象序列化后,日期格式为一长串数字(如

easyui 日期控件清空值

最近用了Easyui的日期控件datebox,项目中要将选中值清空,于是就研究了一下. 1,调用方法清空 [javascript] view plain copy print? $('#yourId').combo('setText',''); 2,更改js文件 从官网下载的源文件中,datebox控件界面只有‘Today’,‘Close’事件,我们可以把清空选项值的事件添加到js中去,这样,只要引用了datebox这个控件,界面上就会有清空选项.具体修改步骤如下: 首先在官网上下载jquery

JQuery easyUi datagrid 中 editor 动态设置最大值最小值

前言 近来项目中使用到 easyui 来进行页面设计,感觉挺方便的,但是网上除了api外,其他有价值的资料比较少,故在此分享一点经验,供大家参考. 问题 JQuery easyUi datagrid 可编辑行的editor属性具有 min 和 max 属性,设置可以输入的最大值和最小值,但是这个是固定的,如下: [html] view plain copy {field:'workRate',title:'<%/*填报*/%><bean:message key="task.wo