返回首页 | 注册送体验金88送现金

合作共赢、快速高效、优质的网站建设提供商

更多精品源码-尽在织梦模板-www.moke8.com

网站开发基于bootstrap完成多个下拉框同时查找功用

时间:2017-09-05 编辑:admin

本文实例为我共享了bootstrap完成下拉框查找展现的详细代码,供我参阅,详细内容如下

1.第一个下拉框代码

 div 
 !--快速查询-- 
 div 
 span i /i /span 
 select data-filter-type="2" name="copyfrom" data-validate="notempty" data-field="name" data-placeholder="查找数据资源" 
 option value="" 请挑选数据资源 /option 
 optgroup label="UNESCO二类中心" 
 #list data.copyfromList as entity 
 #if (entity.type && entity.type == '1') 
 option value="${entity.alias!}" #if (param.copyfrom && param.copyfrom == entity.alias) selected /#if ${entity.alias!} /option 
 /#if 
 /#list 
 /optgroup 
 optgroup label="科技动态与发展" 
 #list data.copyfromList as entity 
 #if (entity.type && entity.type == '7') 
 option value="${entity.alias!}" #if (param.copyfrom && param.copyfrom == entity.alias) selected /#if ${entity.alias!} /option 
 /#if 
 /#list 
 /optgroup 
 optgroup label="其他" 
 #list data.copyfromList as entity 
 #if (entity.type && entity.type == '8') 
 option value="${entity.alias!}" #if (param.copyfrom && param.copyfrom == entity.alias) selected /#if ${entity.alias!} /option 
 /#if 
 /#list 
 /optgroup 
 /select 
 /div 
 /div 

2.第二个下拉框代码

 div 
 !--快速查询-- 
 div 
 span i /i /span 
 select data-filter-type="2" name="cid" data-validate="notempty" data-field="name" data-placeholder="查找栏目称号" 
 option value="" /option 
 #list data.categories as entity 
 option value="${entity.id}" #if (param.cid && param.cid == entity.id) selected /#if ${entity.id} - ${entity.name} /option 
 /#list 
 /select 
 /div 
 /div 

3.后台js代码

bindEvents:function(){
 var self = this, dom = self.element;
 $('select[name="copyfrom"]', dom).change(function(event){
 self.params.copyfrom = $(this).val();
 var url = self.formatParams(self.params);
 window.location.href = "cekasp_article.htm" + url;
 $('select[name="cid"]', dom).change(function(event){
 self.params.cid = $(this).val();
 var url = self.formatParams(self.params);
 window.location.href = "cekasp_article.htm" + url;
 formatParams:function(params){
 var self = this;
 var url = "";
 for(var param in params){
 if(params[param]){
 url += param + "=" + params[param] + "&";
 if(url.length 0){
 url = " " + url.substring(0,url.length-1);
 return url;

4.后台php部分代码

 String categoryId = request.optString("cid");
 if (!ValidateUtil.isNull(categoryId)) {
 // 加载栏目信息
 JSONObject jsonCategory = toJSONObject(adminService.loadById(CekaspCategory.class, categoryId));
 response.put("category", jsonCategory);
 param.addFilter("id", FilterType.IN, articleIdList, 1);
 String copyfrom = request.optString("copyfrom");
 if (!ValidateUtil.isNull(copyfrom)) {
 param.addFilter("copyfrom", FilterType.EQUALS, copyfrom);
 List CekaspArticle articleList = adminService.list(CekaspArticle.class,param);


浏览:

网站建设

流程

    网站建设流程