easyui 日期范围前后台的设置以及实现
2016-05-03 11:37
423 查看
1.页面部分(引入相应的js)
2.js
3.后台
以上代码不是完整,
待续……
<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; }
以上代码不是完整,
待续……
相关文章推荐
- kendo ui grid 高度自适应
- 【Android UI】动态改变ListView布局
- CoreThink主题开发(七)使用H-ui开发博客主题之新闻资讯正文页面
- 知问前端——日历UI(三)
- easyUI获取index值以及修改某列的值
- 【Android UI】具有弹性的ListView
- ios上 更改 状态栏(UIStatusBar)的颜色
- 使用NSOperation以及NSOperationQueue
- UIView的autoresizingMask属性的研究
- UIBezierPath精讲
- Unknown table ‘system_sequences’ in information_schema错误解决
- leetcode 347. Top K Frequent Elements
- NSDictionary中取出value的值赋给float型
- FluentData -Micro ORM with a fluent API that makes it simple to query a database
- android学习笔记---UI布局
- UIView 中常见的方法总结
- 【Android UI】自动显示、隐藏布局的ListView
- Null value was assigned to a property of primitive type setter of
- vue.js-step-everthing-3
- 浅谈requireJS