/**
* 查询字典根据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>
本文介绍了如何在Easy UI中实现表格的动态格式化绑定,特别是当表格值与显示值不同时的处理。通过示例代码展示了查询字典数据的方法,并在表格中使用formatter进行显示。同时,提及了在编辑表格时使用combobox组件,以及如何从后台获取并绑定字典数据。
1856

被折叠的 条评论
为什么被折叠?



