hbuider 中点击就显示出一个单选的列表 ,然后后台跨域向里面动态添加数据,注意里面的格式是json object

jsp页面:

<li class="mui-table-view-cell" onclick="showActionSheet()">
<div class="mui-input-row">
<label>机构类别</label>
<div class="ditem mui-pull-right" > </div>
</li>

、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、

js代码:

var add = function addtype(){
var ajaxUrl=getajaxUrl();
var url = ajaxUrl[0]['nativeIp']+"/mobile/org/type";
mui.ajax(url,{
data:{
tel:1,
code:1
},
dataType:'json',//服务器返回json格式数据
type:'post',//HTTP请求类型
timeout:10000,//超时时间设置为10秒;
success:function(data){
//服务器返回响应,根据响应结果,分析是否登录成功;
var result = eval(data);
result = eval(result);
//获取表中的列数
var count = result[0].count;
var bts=[];
/*var titles='{title:"'+result[0].orgtype[0].name+'"},'*/
if(count>0){
for(var i=0;i<count;i++){
bts.push({title:""+result[0].orgtype[i].name+""});
}
var types = document.getElementById('outputModel');
outSet("");
plus.nativeUI.actionSheet({
title : "选择类别",
cancel: "取消",
buttons: bts
},
function(e) {
if(((e.index > 0) ? bts[e.index - 1].title : "取消")=='取消'){

}else{
types.innerHTML = ((e.index > 0) ? bts[e.index - 1].title : "取消");
/*alert(((e.index > 0) ? bts[e.index - 1].title : "取消"));*/
}

}
);
}
},
error:function(xhr,type,errorThrown){
//异常处理;
console.log(type);
}
});

}

//选择类别
function showActionSheet() {
add();
}