首页 > 代码库 > combobox后台查询,前端下拉显示

combobox后台查询,前端下拉显示

/**
     * 获得数据库数据
     * */
    @Action(value="sysList_data_list")
    public void getSysListDataList(){
        List<Map<String,String>> list  = new ArrayList<Map<String,String>>();
        String hql = " from SysList a where 1=1 ";            
        List<SysList> codeList = sysListService.findAll(hql);
        for(SysList sysCode : codeList){
            //对数据进行重新编码
            Map<String,String> map = new HashMap<String,String>();
            map.put("Code",String.valueOf(sysCode.getSysId()));//code
            map.put("Name",sysCode.getSysName());
            list.add(map);
        }
        writeJson(list);
    }
    //下拉
    function initSysIdName(){  
        var $sysIdName=$("#sysIdName");
        $sysIdName.ComboBox({
            url: basePath + ‘sysList/sysList_data_list.action?sysId=‘+sysId,
            param: { categoryCode: "FBLM_NAME" },
            id: "Code",
            text: "Name",
            height: "100px",
            description: "==请选择=="
        });
        $sysIdName.bind("change", function () {
            var value = http://www.mamicode.com/$(this).attr(‘data-value‘);
            $("#sysId").val(value);   
        });
    }
       <th class="formTitle">所属系统:</th>
	<td class="formValue">
	    <input id="sysId" type="hidden" name="sysFunction.sysId"  />
	    <div id="sysIdName" type="select"  name="sysIdName" class="ui-select " isvalid="yes" checkexpession="NotNull"> 
	    <ul>
            </ul>                           
            </div>
        </td>

  

combobox后台查询,前端下拉显示