老手网

DWZ (JUI) dwzPageBreak切换显示页数失效的正确解决办法

分类:javascript 作者:oldhand 来源: 发布:2013-05-14 09:34:30
同样的一个问题,
网上搜出的解决不了问题,
发现加的代码是不对的
serializeArray序列化以后再去赋值,有点搞笑了。


function dwzPageBreak(options){
	var op = $.extend({ targetType:"navTab", rel:"", data:{pageNum:"", numPerPage:"", orderField:"", orderDirection:""}, callback:null}, options);
	var $parent = op.targetType == "dialog" ? $.pdialog.getCurrent() : navTab.getCurrentPanel();

	if (op.rel) {
		var $box = $parent.find("#" + op.rel);
		var form = _getPagerForm($box, op.data);

		// by oldhand,替换form中的numPerPage值  
        if (op.numPerPage) {        
			form[DWZ.pageInfo.numPerPage].value = op.numPerPage; 
        }  

		if (form) {
			$box.ajaxUrl({
				type:"POST", url:$(form).attr("action"), data: $(form).serializeArray(), callback:function(){
					$box.find("[layoutH]").layoutH();
				}
			});
		}
	} else {
		var form = _getPagerForm($parent, op.data);

		// by oldhand,替换form中的numPerPage值  
        if (op.numPerPage) {        
			form[DWZ.pageInfo.numPerPage].value = op.numPerPage; 
        }  

		var params = $(form).serializeArray();
		
		if (op.targetType == "dialog") {
			if (form) $.pdialog.reload($(form).attr("action"), {data: params, callback: op.callback});
		} else {
			if (form) navTab.reload($(form).attr("action"), {data: params, callback: op.callback});
		}
	}
}

 

-
分享到:

Copyright © 2012 - 2014 oldhand.cn All Rights Reserved. 粤ICP备13025864号