replace substitution variables to the accepted

Copyright: Hello, Bug https://blog.csdn.net/AdminPwd/article/details/90234389

Today, at the time of writing projects, we presented a demand
Demand picture
which use to replace the
previous code is as follows

myJqGrid.prototype.gridComplete = function(){
	var tableData = $( '#jqGridPager_right' ).find( 'div' );
	var jqGrid = $("#"+this.GridId).jqGrid('getGridParam', 'records');//获取JqGrid总记录数
	if(jqGrid>100){
		//对其进行替换 ig表示正则表达式,全文匹配,忽略大小写
		tableData.html(tableData.html().replace(/共/ig,'大于'))
		tableData.html(tableData.html().replace(/jqGrid/ig,'大于'))
	
	}
	};

JqGrid which is passed from the page to the value, but this match just write this letter is jqGrid not match the value of a page to the
last match so you can change from page to which the value of the

myJqGrid.prototype.gridComplete = function(){
	var tableData = $( '#jqGridPager_right' ).find( 'div' );
	var jqGrid = $("#"+this.GridId).jqGrid('getGridParam', 'records');//获取JqGrid总记录数
	if(jqGrid>100){
		//对其进行替换 ig表示正则表达式,全文匹配,忽略大小写
		tableData.html(tableData.html().replace(/共/ig,'大于'))
		tableData.html(tableData.html().replace(new RegExp(jqGrid,'g'),'100'))

	}
	};

new one, this would resolve the

Guess you like

Origin blog.csdn.net/AdminPwd/article/details/90234389