dwz-min.js扩展增加查找带回时回调方法
var _lookup = {currentGroup:"", suffix:"", $target:null, pk:"id",callback:null};
callback:null /* callback为后增加的 */
$.extend({
bringBackSuggest: function(args){
var $box = _lookup['$target'].parents(".unitBox:first");
$box.find(":input").each(function(){
var $input = $(this), inputName = $input.attr("name");
for (var key in args) {
var name = (_lookup.pk == key) ? _util.lookupPk(key) : _util.lookupField(key);
if (name == inputName) {
$input.val(args[key]);
break;
}
}
});
//add by zdd start
var callback = _lookup['callback']; /* 这6行是增加的 处理回调 */
try
{
eval(callback+"();");
}
catch (e){}
//end
},
bringBack: function(args){
$.bringBackSuggest(args);
$.pdialog.closeCurrent();
}
});
lookup: function(){
return this.each(function(){
var $this = $(this), options = {mask:true,
width:$this.attr('width')||820, height:$this.attr('height')||400,
maxable:eval($this.attr("maxable") || "true"),
resizable:eval($this.attr("resizable") || "true")
};
$this.click(function(event){
_lookup = $.extend(_lookup, {
currentGroup: $this.attr("lookupGroup") || "",
callback: $this.attr("callback"), /* 这一行是增加的 */
suffix: $this.attr("suffix") || "",
$target: $this,
pk: $this.attr("lookupPk") || "id"
});
var url = unescape($this.attr("href")).replaceTmById($(event.target).parents(".unitBox:first"));
if (!url.isFinishedTm()) {
alertMsg.error($this.attr("warn") || DWZ.msg("alertSelectMsg"));
return false;
}
$.pdialog.open(url, "_blank", $this.attr("title") || $this.text(), options);
return false;
});
});
},
使用说明:
<input type="text" name="article.articletitle" class="required">
<input id="articleId" name="article.articleid" class="required textInput valid" type="hidden"
lookupPk="articleid" lookupgroup="article"
suggestfields="articleid,articlepath,articletitle" >
<a class="btnLook" href="${path}/pages/admin/imgmanage/getArticle.htm" lookupgroup="article"
callback="article_img_callback" lookupPk="articleid" title="文章列表" width = "1200" height = "600">查找带回</a>
function article_img_callback(){
alert("sss");
}