下拉框自动获取数据库字段值代码

java代码:
public void ajax() throws IOException, InvocationTargetException, NoSuchMethodException, IllegalAccessException
    {
        Map map = new HashMap();
        List list = getUserService().queryForList(map);
        responseText(EasyuiUtil.toComboboxData(list, "user_id,user_name"));
    }
	
	JAVASCRIPT代码
	$('#diray_project_id').combobox({
			url:'${ctx}project_ajax_list.do',
		    valueField:'project_id',
			textField:'project_name',
			editable:false,
			value:'',
			panelHeight:60
		});
		
		$('#finddiray_project_id').combobox({
			url:'${ctx}project_ajax_list.do',
		    valueField:'project_id',
			textField:'project_name',
			editable:false,
			value:'',
			panelHeight:60,
			onChange:function(){
				easyui_form_query('dg_diray');
			}
		});
		
		添加/编辑页面
		
				项目名称:
				
                   
					
				
			

你可能感兴趣的:(前端)