无刷新分页和jtemplates的使用

自己使用的无刷新分页是用jquery,json,jtemplates联合使用的。

	var pagination;
	$(function(){
		pagination=$("#page").myPagination({
        	currPage: 1,
        	pageNumber: 16,
        	ajax: { 
    			on: true,  
    			callback: ajaxCallBack,   			
    			type: "GET", 
    			url: "../patientHologram/physicalExamInfoAction!loadPhysicalExamInfoList.htm?p_main_id="+ p_main_id+"&line_time="+line_time+"&tabtype="+tabtype, 
    			dataType: "json" 
    		},
    		panel: {
        	next: '>',
            prev: '<',
            tipInfo_on: true,
            tipInfo: '  跳{input}/{sumPage}页',
            tipInfo_css: {
              	width: "34px",
              	height: "18px",
              	border: "1px solid #DADAD8",
              	padding: "0 5px 0 5px",
              	margin: "0 5px 0 5px",
              	color: "#343434"
            }
        }    		
	});
	});
	function ajaxCallBack(data){
	rows = data.rows;
	$("#table").setTemplateElement("Template-ListRows").processTemplate(rows);
	/* var colors = ['#fefefe', '#F9FAFC'];
    $("table").find("tr").each(function (i) {
    	if($(this).attr("id")!="tableTitle" && $(this).attr("id")!="roletitle"){
    		$(this).css("background-color", colors[i % 2]);
    	}
    }); */
 }

  


当然记得别忘记引用js文件

利用ajax将数据传到action,再利用json数据返回,并将其解析


你可能感兴趣的:(javaweb积累)