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;
}
以上代码不是完整,
待续……
easyui 日期范围前后台的设置以及实现的更多相关文章
- 转 EasyUi日期控件datebox设置,只显示年月,也只能选择年月
1.引入Jquery和easyui,注低版本的Jquery和easy不能使用,这里使用的Jquery是1.8.2easyui是1.6.1.1.easyui下载地址:http://www.jeasyui ...
- easyUI日期框返回到月份,选择日期也只到月份
easyUI日期框返回到月份,选择日期也只到月份,不是原创,引用了园友的一篇文章,自己写下来,以便不时之需,谢谢. 1 $(function () { $('#date').datebox({ onS ...
- jquery easyUI 日期格式化,DateBox只显示年
jquery easyUI 日期格式化,DateBox只显示年 >>>>>>>>>>>>>>>>> ...
- MySQL 日期类型及默认设置 (除timestamp类型外,系统不支持其它时间类型字段设置默认值)
MySQL 日期类型及默认设置 之前在用 MySQL 新建 table,创建日期类型列时遇到了一些问题,现在整理下来以供参考. MySQL 的日期类型如何设置当前时间为其默认值? 答:请使用 time ...
- easyui日期在未加载easyui-lang-zh_CN.js出现英文的情况下加载中文的方法
我们有时候在操作easyui的时候本来是加载了easyui-lang-zh_CN.js中文文件包,但是还是出现了英文.使得我们不得埋怨这框架咋这么不好用,其实我们仔细看看这个中文包就会发现里面很多都是 ...
- EasyUI 日期选择插件封装成选择到月份的插件
将普通的日期选择插件封装成选择到月份的插件: var nowMonth = new Date(); var month = ...
- JQuery EasyUI 日期控件 怎样做到只显示年月,而不显示日
标题问题的答案在OSChina中 http://www.oschina.net/question/2282354_224401?fromerr=lHJTcN89 我还是把这个记录下来 ======== ...
- EasyUI日期时间框DateTimeBox
WEB DEMO 日期时间框 DateTimeBox <!DOCTYPE html> <html> <HTML> <head> <HEAD> ...
- Eclipse自动生成作者、日期注释等功能设置
我们在使用Eclipse 编写Java代码时,自动生成的注释信息都是按照预先设置好的格式生成的. 修改作者.日期注释格式:打开Windows->Preferences->Java-> ...
随机推荐
- Android-一张图理解MVP的用法
M和V通过P交互,M做了两件事,开启子线程做耗时操作,然后使用原生的Hander方式切回主线程回调结果给P. M做的两件事也可以使用比较流行的rxjava实现: 备注:图片不清晰可以看这里
- MySql常用函数积累
--MySql查看表结构 select column_name,data_type,CHARACTER_MAXIMUM_LENGTH,column_comment from information_s ...
- Info.plist 的字段解释
bundle字段 这些字段名都是XML中的名称,在xcode的属性编辑器中,名字并不相同 bundle目录中的属性列表详细描述了有关该bundle的信息.Finder和一些系统API在一些情况下会使用 ...
- Qt5官方demo解析集30——Extending QML - Binding Example
本系列全部文章能够在这里查看http://blog.csdn.net/cloud_castle/article/category/2123873 接上文Qt5官方demo解析集29--Extendin ...
- SolidEdge 工程图中如何绘制中断视图
右击长条形的视图,点击新增断裂线,然后绘制两个断点 点击完成之后效果如下图所示 如果要修改断裂视图的样式,则选中这个视图,在左键单击,然后点击这个按钮取消显示断裂视图 然后左键单击断裂视图 ...
- [poj 2331] Water pipe ID A*迭代加深搜索(dfs)
Water pipe Time Limit: 3000MS Memory Limit: 65536K Total Submissions: 2265 Accepted: 602 Description ...
- 配置resin支持maven项目
1. 在resin.conf中找到 <!-- includes the app-default fordefault web-app behavior --> <resin:impo ...
- 我对hibernate和mybatis框架的比較
系统在选择操作数据库的框架上面,究竟是选择hibernate,还是mybatis. 首先说下两者的原理,假设你要关联几张表做查询,查出20条记录: 1.假设是mybatis SELECT * FR ...
- HDOJ_ How can I read input data until the end of file ?
Language C C++ Pascal To read numbers int n;while(scanf("%d", &n) != EOF){ ...} int n; ...
- thinkphp Class 'PDO' not found 错误
thinkphp Class 'PDO' not found 错误,原因mysql5.7.26缺少pdo驱动,需要安装php的pdo和pdo_mysql扩展 本文以centOS为例 1.进入PHP源码 ...