jQuery combobox获取List

jQeury combobox 使用 

JSP代码:

$(function{

var areaid = $("input[name=areaid]");
areaid.combobox({
url : "${ctx}/ttesBillController.do?method=getTicket",
cache:"false",
valueField: "areaid",                      //传递的值
textField: "tickeBegin",                  //显示的字段
formatter : function(row) {
return row.tickeBegin + " - " + row.ticketEnd;         //下拉显示数据
},
onSelect : function(rec) {
getBill();                                            //选中下拉触发事件
},
onLoadSuccess : function() {                                    //返回Success 回调方法
var data = areaid.combobox("getData");
if (data.length > 0) {
areaid.combobox("setValue", data[0].areaid);                 //自动选中下拉的第一条数据
getBill();
} else {
areaid.combobox("clear");
}
}
});

});


Java代码:

public ModelAndView getTicket(HttpServletRequest request,
HttpServletResponse response) throws Exception {
String specialid = request.getParameter("specialid");
List tickeList = getAvailableTicket(specialid);
renderJson(response, JsonUtil.toString(tickeList, JsonUtil.COLLECTION_FILTER));
return null;
}

你可能感兴趣的:(jquery,exception,jsp,function,list,filter)