easy ui 表格格式化动态绑定,表格格式化后获取表格值是value而不是显示的值

来源:互联网 发布:童声配音软件 编辑:程序博客网 时间:2024/03/29 19:30









/**
* 查询字典根据code
* @return
*/
@ArchivesLog(operationType="查询操作:",operationName="查询字典") 
@ResponseBody
@RequestMapping(value="/getMapByCode", method = RequestMethod.POST)
public Map<String,String> getMapByCode(DictionaryBean dictionaryBean) {
Json j = new Json();
 
Map<String,String> map=new HashMap<String,String>();
List<DictionaryBean> list = dictionaryService.selectByCode(dictionaryBean.getCode());
for(DictionaryBean db:list){
map.put(db.getDictionaryKey(), db.getDictionaryValue());
}
j.setObj(map);
return map;
}



//初始化工资类别字典

var dictionaryMap;
$(function(){
$.ajax(
                {
                    type: 'POST',
                    url: path+'/dictionary/getMapByCode/?code=gongzileixing',   
                    data: {},
                    dataType:'json',
                    success: function (data) {
                      dictionaryMap=data;
                    }
                });
})
function formatterWageCategory(value, row, index){ 
return dictionaryMap[value];

<th field="wageCategory" width="100"  formatter="formatterWageCategory"
editor=" {
type : 'combobox',
options : {
valueField : 'dictionaryKey',
textField : 'dictionaryValue',
method : 'post',
url : '${path}/dictionary/get/?code=gongzileixing',
//required : true
}
}"
>工资类别</th>

原创粉丝点击