jeecg如何在一个页面使用按钮选择弹出选择框

1.在页面需要的地方加上如下代码:

<input id="userId" name="userId" type="hidden" style="width: 150px" class="inputxt" ignore="ignore"/>
<input name="userName" class="inputxt" value="" id="userName" readonly="readonly" datatype="*"/>

<t:choose width="800" height="600" hiddenName="userId" hiddenid="id" url="apiUserController.do?users" name="userList"
          icon="icon-search" title="选择操作标签" textname="userName" isclear="true"
          isInit="true"></t:choose>
2.userId是需要传入后台的,userName是页面展示的,<t:choose>标签的url指向后台跳转,textname---显示的文本(字段),isclear清除-重置按钮

3.后台方法

@RequestMapping(params = "users")
public ModelAndView users(HttpServletRequest request) {
   ModelAndView mv = new ModelAndView("com/jeecg/api_user/usersSelect");
   String ids = oConvertUtils.getString(request.getParameter("ids"));
   mv.addObject("ids", ids);
   return mv;
}
4.前台页面

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<!DOCTYPE html >
<html>
<head>
<title>用户集合</title>
<t:base type="jquery,easyui,tools"></t:base>
</head>
<body style="overflow-y: hidden" scroll="no">
<t:datagrid  pagination="false"  name="userList" title="用户选择"  actionUrl="apiUserController.do?datagrid" idField="id"  checkbox="false" showRefresh="false"  fit="true"  queryMode="group" onLoadSuccess="initCheck">
   <t:dgCol title="common.id" field="id" hidden="true"></t:dgCol>
   <t:dgCol title="用户名" field="userName" width="50" query="true" ></t:dgCol>
   <t:dgCol title="手机"  field="phone"   query="true" queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="头像"  field="userImg"    queryMode="single"  width="250" image="true" imageSize="50,50" ></t:dgCol>
   <t:dgCol title="简介"  field="info"    queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="用户角色"  field="role"   query="true" queryMode="single" dictionary="role_t" width="120"></t:dgCol>
   <t:dgCol title="称号"  field="sign"   query="true" queryMode="single"  width="120"></t:dgCol>
</t:datagrid>
</body>
</html>
<script type="text/javascript">
function initCheck(data){
   var ids = "${ids}";
   var idArr = ids.split(",");
   for(var i=0;i<idArr.length;i++){
      if(idArr[i]!=""){
         $("#userList").datagrid("selectRecord",idArr[i]);
      }
   }
}
</script>

Bootstrap是一个流行的前端架,它提供了一套响应式、移动设备优先的前端架,用于快速开发基于HTML、CSS和JavaScript的用户界面。使用Bootstrap可以很容易地创建一个提交选择,并且处理用户的选择。以下是一个简单的示例,展示如何使用Bootstrap制作一个提交选择: 1. 首先,确保你的项目中已经包含了Bootstrap的CSS和JavaScript文件。你可以通过CDN链接来引入它们。 ```html <!-- Bootstrap CSS --> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"> <!-- Bootstrap JS --> <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script> ``` 2. 接着,创建一个表单,其中包含多个复选以及一个提交按钮。 ```html <form id="selectionForm"> <div class="form-check"> <input class="form-check-input" type="checkbox" value="option1" id="option1"> <label class="form-check-label" for="option1"> 选项 1 </label> </div> <div class="form-check"> <input class="form-check-input" type="checkbox" value="option2" id="option2"> <label class="form-check-label" for="option2"> 选项 2 </label> </div> <!-- 可以继续添加更多选项 --> <button type="button" class="btn btn-primary" onclick="submitSelection()">提交选择</button> </form> ``` 3. 使用JavaScript来处理点击按钮时的行为。当按钮被点击时,获取所有选中的复选值,并显示它们。这里使用一个简单的JavaScript函数来展示这个行为。 ```javascript <script> function submitSelection() { var selectedValues = []; // 获取所有复选,并检查它们是否被选中 $('.form-check-input:checked').each(function() { selectedValues.push($(this).val()); }); // 显示选中的值 alert("您选择了: " + selectedValues.join(", ")); } </script> ``` 这样,当用户选择了一些选项并点击提交按钮后,会弹出一个包含所有选中选项值的提示
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值