jQuery框架下的多选文本框

来源:互联网 发布:linux 脚本优先级 编辑:程序博客网 时间:2024/03/28 18:41

 

<linkrel="stylesheet"type="text/css"href="http://www.jeasyui.com/easyui/themes/default/easyui.css">

<linkrel="stylesheet"type="text/css"href="http://www.jeasyui.com/easyui/themes/icon.css">

<linkrel="stylesheet"type="text/css" href="http://www.jeasyui.com/easyui/themes/color.css">

<linkrel="stylesheet"type="text/css"href="http://www.jeasyui.com/easyui/demo/demo.css">

<scripttype="text/javascript"src="http://code.jquery.com/jquery-1.6.min.js"></script>

<scripttype="text/javascript"src="http://www.jeasyui.com/easyui/jquery.easyui.min.js"></script>

多选框



<body>

  

   <divstyle="margin:20px 0"></div>

   <selectclass="easyui-combogrid"style="width:250pxmultiple="multiple"

       data-options="

           // panelWidth: 500,

            idField: 'userId',

            textField: 'userId',

            url: '<%=basePath%>MyBooks/showAllUser',

            method: 'post',

            columns: [[

                { field:'ck', checkbox:'true'},

                {field:'userName',title:'Product'},

                {field:'userId',title:'ItemID'}

             

            ]],

            fitColumns: true

        ">

   </select>

  </body>

 

 

private JSONObject result;//返回的json

/**

*

* @return

* @throwsException

*/

public String showAllUserAction()throws Exception {

 

UserPageImpl daoPage = new UserPageImpl();//

// 当前页,page由分页工具负责传过来

int intPage = Integer.parseInt((page ==null || page == "0") ? "1" : page);

System.out.println("intPage:\t"+ intPage);

// 每页显示条数

int number = Integer.parseInt((rows ==null || rows == "0") ? "20" : rows);

System.out.println("number:\t" + number);

// 每页的开始记录第一页为1第二页为number +1

Map<String, Object> jsonMap = new HashMap<String,Object>();//定义map

List<User> userslist =daoPage.getStudent(intPage, number);//

// 每一页存放的数据

jsonMap.put("total",daoPage.getTotalPages());// total存放总记录数,必须的

// ,EasyUI根据这个参数,可以计算pagenumber的值,这个值不是users的长度

jsonMap.put("rows", userslist);// rows存放每页记录 list

result= JSONObject.fromObject(jsonMap);//格式化result 一定要是JSONObject

System.out.println("result:\t"+result.toString());

return SUCCESS;

}

 

public JSONObject getResult() {

return result;

}

 

    public void setResult(JSONObjectresult) {

        this.result = result;

    }

 

 

 

<packagename="test"extends="json-default">

 

        <actionname="showAllUser"class="com.bus.UserPageAction"

            method="showAllUserAction">

            <resultname="success"type="json">

                <paramname="root">result</param>

 

            </result>

        </action>

    </package>

0 0