取控件id 的值 为: “#
memberId
“).val();
//注意一定要在 member 后拼上 Id
<div class=”controls”>
<
sys:treeselect
id=”member” name=”
member.id
” value=”${act.member.id}” labelName=”
member.name
” labelValue=”${act.member.name}”
title=”用户” url=”/sys/office/treeData?type=3″ allowClear=”true” cssClass=”required” notAllowSelectParent=”true”/>
<span class=”help-inline”><font color=”red”>*</font> </span>
</div>
——————————————————-
function
member
TreeselectCallBack(v, h, f){/
/回调
sys:treeselect
方法用法
if(“ok” == v){//
点击确认
//获取指定用户信息
$.get(“${ctx}/ps/MemberG/getUser?id=” + $(“#
memberId
“).val(), function(data){
//设置input值
var tel=data.mobile;
$(“#contact”).val(tel);
});
}
} //
ajax返回指定用户
———–
-下面为sys:treeselect 控件代码
<script type=”text/javascript”>
$(“#${id}Button, #${id}Name”).click(function(){
// 是否限制选择,如果限制,设置为disabled
if ($(“#${id}Button”).hasClass(“disabled”)){
return true;
}
// 正常打开
top.$.jBox.open(“iframe:${ctx}/tag/treeselect?url=”+encodeURIComponent(“${url}”)+”&module=${module}&checked=${checked}&extId=${extId}&isAll=${isAll}”, “选择${title}”, 420, 420, {
ajaxData:{selectIds: $(“#${id}Id”).val()},buttons:{“确定”:”ok”, ${allowClear?”\”清除\”:\”clear\”, “:””}”关闭”:true},
submit:function(v, h, f){
if (v==”ok”){
var tree = h.find(“iframe”)[0].contentWindow.tree;//h.find(“iframe”).contents();
var ids = [], names = [], nodes = [];
if (“${checked}” == “true”){
nodes = tree.getCheckedNodes(true);
}else{
nodes = tree.getSelectedNodes();
}
for(var i=0; i<nodes.length; i++) {//<c:if test=”${checked && notAllowSelectParent}”>
if (nodes[i].isParent){
continue; // 如果为复选框选择,则过滤掉父节点
}//</c:if><c:if test=”${notAllowSelectRoot}”>
if (nodes[i].level == 0){
top.$.jBox.tip(“不能选择根节点(”+nodes[i].name+”)请重新选择。”);
return false;
}//</c:if><c:if test=”${notAllowSelectParent}”>
if (nodes[i].isParent){
top.$.jBox.tip(“不能选择父节点(”+nodes[i].name+”)请重新选择。”);
return false;
}//</c:if><c:if test=”${not empty module && selectScopeModule}”>
if (nodes[i].module == “”){
top.$.jBox.tip(“不能选择公共模型(”+nodes[i].name+”)请重新选择。”);
return false;
}else if (nodes[i].module != “${module}”){
top.$.jBox.tip(“不能选择当前栏目以外的栏目模型,请重新选择。”);
return false;
}//</c:if>
ids.push(nodes[i].id);
names.push(nodes[i].name);//<c:if test=”${!checked}”>
break; // 如果为非复选框选择,则返回第一个选择 </c:if>
}
$(“#${id}Id”).val(ids.join(“,”).replace(/u_/ig,””)).trigger(“change”);
$(“#${id}Name”).val(names.join(“,”)).trigger(“change”);
}//<c:if test=”${allowClear}”>
else if (v==”clear”){
$(“#${id}Id”).val(“”);
$(“#${id}Name”).val(“”);
}//</c:if>
if(typeof ${id}TreeselectCallBack == ‘function’){
${id}TreeselectCallBack(v, h, f);/
/
自己封装的回调方法 可以传参数
}
}, loaded:function(h){
$(“.jbox-content”, top.document).css(“overflow-y”,”hidden”);
}
});
});
</script>
———————————-