jQuery MiniUI

标题: miniui [打印本页]

作者: Colver    时间: 2017-6-21 10:55:01     标题: miniui

前台html代码:
<input id="id" class="mini-combobox" property="editor" readonly="true"
                                                                                style="width: 100%;" textField="text" valueField="id"
                                                                                url="/sotc-ec-management-web/query/varietysParams"/>
后台代码:
        @RequestMapping(value = "/query/varietysParams")
        public String queryParas(HttpServletRequest request,HttpServletResponse response,
                        @RequestParam Map<String, Object> param,String tablename){
                String jsonDatas = "";
                StringBuilder sb = new StringBuilder();//构造json
                try {
                        String data = request.getParameter("data");
                        String parameterCode= StringUtil.toString(param.get("parameterCode"));
                        HashMap map = new HashMap();
                        map.put("parameterCode", parameterCode);
                       
                        List<HashMap> List = parameterService.queryParas(map);
                    sb.append("[");
                    for (HashMap hashMap : List) {
                            sb.append("{id:\""+(String) hashMap.get("itemCategoryType")+"\""+",text: \""+
                                            (String) hashMap.get("itemCategoryTypeName")+"\"}"+",");
                        }
                    if (sb.length()>0) {
                            sb.deleteCharAt(sb.length() - 1);
                    }
                    sb.append("]");
                    
                } catch (Exception e) {
                        e.printStackTrace();
                }
                return sb.toString();//[{id:"**",text:"**"}]
        }
页面中一直报:org.thymeleaf.exceptions.TemplateInputException: Error resolving template "[{id:"A02",text: "进口炼焦煤"},{id:"A01",text: "进口铁矿石"}]", template might not exist or might not be accessible by any of the configured Template Resolvers
这该怎么解决?
作者: felt    时间: 2017-6-21 11:42:40

你这报错是后台错误,MiniUI只是js控件,不管后台的,只要你后台传到前端正确格式的数据就可以。
combobox需要这样格式的数据[{id:"",text:""},{},{}]
作者: Colver    时间: 2017-6-21 15:07:57

felt 发表于 2017-6-21 11:42
你这报错是后台错误,MiniUI只是js控件,不管后台的,只要你后台传到前端正确格式的数据就可以。
combobox ...

我这个现在return的就是[{id:"",text:""},{}]这种类型的呀
作者: felt    时间: 2017-6-21 17:29:18

Colver 发表于 2017-6-21 15:07
我这个现在return的就是[{id:"",text:""},{}]这种类型的呀

[attach]9393[/attach]打开浏览器工具,看一下网络交互,看前端获取到的数据格式到底对不对。




欢迎光临 jQuery MiniUI (http://miniui.com/discuss/) Powered by Discuz! X2