bsgrid

网址:http://bsgrid.oschina.mopaasapp.com/

var total = gridObj.options.totalRows;

jquery必须放在bsgrid的前面

根据条件生成不同的操作

 

function render_operate0(record, rowIndex, colIndex, options) {
		var str='  ';  
		if(record.Status ==1){
			str+= '<a title="退款" onclick="return(\'编辑\',\'${ctx}/count/callbank?id='+record.id+'\')" val='+record.id+' href="#"><span>退款</span></a>';
		 }
}

 

格式化金额:

<th w_index="amt" w_render="render_amt">金额(元)</th>

function render_amt(record, rowIndex, colIndex, options){
  return fmoney(record.amt,2);
}

function fmoney(s, n) { 
	if(null==s){
		return "0.00";
	}
	n = n > 0 && n <= 20 ? n : 2; 
	s = parseFloat((s + "").replace(/[^\d\.-]/g, "")).toFixed(n) + ""; 
	var one = "";
	if(s.startWith("-")){
		s = s.replace("-","");
		one = "-"
	}
	
	var l = s.split(".")[0].split("").reverse(), r = s.split(".")[1]; 
	t = ""; 
	for (i = 0; i < l.length; i++) { 
		t += l[i] + ((i + 1) % 3 == 0 && (i + 1) != l.length ? "," : ""); 
	} 
	return one+t.split("").reverse().join("") + "." + r; 
} 

  

 序号:<th w_num="total_line" width="3%;">序号</th>

 

        function render_operator(record, rowIndex, colIndex, options){
            var astr = [];
            if(record.status==0){
                astr.push('<a class="ml-5" href="javascript:onclick=update(\''+record.loginId+'\',\''+record.msgId+'\')">');
                astr.push('推送</a>');

            }else {
                astr.push('<a class="ml-5" href="javascript:onclick=deleteMsg(\''+record.loginId+'\',\''+record.msgId+'\')">');
                astr.push('删除</a>');

            }
            return  astr.join("");
        }

 \' :表示单引号(')

  

 

posted on 2016-04-11 11:51  james-roger  阅读(514)  评论(0编辑  收藏  举报