- /**
- * 数得数据字典文本
- * @param code
- */
- function getDicText(code,fun){
- $.ajax({
- type:"post",
- url:"../common/dicList.htm",
- data:{code:code},
- dataType:"json",
- async:false,
- success:function(data){
- fun(data);
- }
- });
- }
- /**
- * 缓数数据字典
- * @param value
- * @param rowData
- */
- function cacheDic(value,code){
- if(dicMap[code]==undefined){
- getDicText(code,function(data){
- if((typeof data=='object')&&data.constructor==Array){
- var obj={};
- $(data).each(function(i,item){
- if(item.value!="!"){
- obj[item.value]=item.text;
- }
- });
- dicMap[code]=obj;
- }
- });
- }
- if(dicMap[code][value]==undefined){
- return "";
- }
- return dicMap[code][value];
- }
- /**
- * 格式化数据字典
- * @param value
- * @param rowData
- * @param rowIndex
- */
- function formartDic(value,code){
- return cacheDic(value,code);
- }
- //该片段来自于http://www.codesnippet.cn/detail/3012201411426.html
来源: http://www.codesnippet.cn/detail/3012201411426.html