formatter转换ID为值

设置字典缓存

  var DictionaryItem = {};

$.post('/Dictionary/GetDictionary/T_RKXD', function (json) {
$.data(DictionaryItem, 'XD', json);
});

 

替换ID为值

function formatDic(value, row) {
return getText("XD", value);
}

function getText(code, value) {
var _DictionaryItem = $.data(DictionaryItem, code);
for (var i = 0; i < _DictionaryItem.length; i++) {
if (_DictionaryItem[i].id == value) {
return _DictionaryItem[i].text;
}
}
}

posted on 2014-09-28 08:53  阿拉伯顶峰  阅读(203)  评论(0编辑  收藏  举报