jqgrid---将列表中的字典值转换成中文词义

第一步,在所在的列中添加属性:

editable: true,

formatter:enteredKbFmatter  //此处为自定义的方法名称

如下:

colModel:[ 
	{name:'mainId', key : true, index:'id',hidden:true}, 
	{name:'app',index:'app',width:'5%',align:"center"}, 
	{name:'v', index:'v',width:'5%',align:"center"},
	{name:'typ', index:'typ',width:'5%',align:"center"},
	{name:'info', index:'info',width:'5%',align:"center"},
	{name:'answer', index:'answer',width:'5%',align:"center"},
	{name:'clientCity', index:'clientCity',width:'5%',align:"center"},
	{name:'region', index:'region',width:'5%',align:"center"},
	{name:'userid', index:'userid',hidden:true},
	{name:'loginid', index:'loginid',hidden:true},
	{name:'mode', index:'mode',width:'5%',align:"center"},
	{name:'service', index:'service',width:'5%',align:"center"},
	{name:'from', index:'from',width:'5%',align:"center"},
	{name:'qtime', index:'qtime',width:'5%',align:"center"},
	{name:'status', index:'status',width:'5%',align:"center"},
	{name:'enteredKb', index:'enteredKb',width:'5%',align:"center",editable: true, formatter:enteredKbFmatter}
], 


第二步,定义对应的方法,根据字典值返回对应词义,如下:

function enteredKbFmatter (cellvalue, options, rowObject) {
			if(cellvalue == true){
				return "是"; 
			}else{
				return "否"; 
			}
			
		}


你可能感兴趣的:(jqgrid---将列表中的字典值转换成中文词义)