。。。
}
/**添加页面的topic下拉框*/
getTopic('${base}/subscribe/queryAllTopics.action');
function getTopic(url){
$.ajax({
type: "GET",
url: url,
success: function(msg) {
var topicData = [];
topicData.push({
'id' : 0,
'text' : '请选择'
});
$.each(msg, function(i) {
topicData.push({
'id': i,
'text': msg[i]
});
});
//设置默认值为请选择,一定是setValue,而不是setText.
$('#topicAdd').combobox('setValue', '请选择');
$('#topicAdd').combobox('loadData', topicData);
}
});
}
/**team pool identity 三级联动*/
getTeam('${base}/subscribe/queryTeams.action');
function getTeam(url){
$.ajax({
type: "GET",
url: url,
success: function(msg) {
var teamData = [];
teamData.push({
'id' : -1,
'text' : '请选择'
});
$.each(msg, function(i) {
teamData.push({
'id': i,
'text': msg[i]
});
});
$('#teamAdd').combobox('setValue', '请选择');
$('#poolAdd').combobox('setValue', '请选择');
$('#identityAdd').combobox('setValue', '请选择');
$('#teamAdd').combobox('loadData', teamData);
$('#teamAdd').combobox({
'onSelect':function(node){
getPool(node.text);
}
});
}
});
}
function getPool(val){
if(val == '请选择') {
$('#poolAdd').combobox('setValue', '请选择');
$('#poolAdd').combobox('loadData', '');
$('#identityAdd').combobox('setValue', '请选择');
$('#identityAdd').combobox('loadData', '');
}
else {
$.getJSON(
"${base}/subscribe/queryPoolsByTeam.action?team="+val,
function(pool) {
var poolData = [];
poolData.push({
'id' : -1,
'text' : '请选择'
});
$.each(pool, function(i) {
poolData.push({
'id': i,
'text': pool[i]
});
});
$('#poolAdd').combobox('setValue', '请选择');
$('#identityAdd').combobox('setValue', '请选择');
$('#poolAdd').combobox('loadData', poolData);
$('#poolAdd').combobox({
'onSelect':function(pool){
getIdentity(val,pool.text);
}
});
}
);
}
}
function getIdentity(team,pool){
//$('#identity').combobox('clear');
if(pool=='请选择') {
$('#identityAdd').combobox('setValue', '请选择');
$('#identityAdd').combobox('loadData', '');
}
else {
$.getJSON(
"${base}/subscribe/queryIdentityByTeamAndPool.action?team="+team+"&pool="+pool,
function(identity) {
var identityData = [];
identityData.push({
'id' : -1,
'text' : '请选择'
});
$.each(identity, function(i) {
identityData.push({
'id': i,
'text': identity[i]
});
});
$('#identityAdd').combobox('setValue', '请选择');
$('#identityAdd').combobox('loadData', identityData);
}
);
}
}