本帖最后由 lyyzms 于 2012-08-08 09:50:52 编辑

解决方案 »

  1.   

    需要转换  formatter : function( val, opts,rowdata) {
                                         return  //这里对rowdata转换
    }
      

  2.   

    int类型的都不显示么,不应该啊,int类型的跟String一样,不需转换
      

  3.   

    不显示啊,而且找不出原因。而且,如果类型有一个不是String,所有的都不显示出来,除非每一个类型都是String
      

  4.   

    可能是后台的数据没有转换为json格式数据,贴出代码来看一下
      

  5.   

    JS:
    $("#recordListManageGrid").JqGrid({
    gridId:'recordListManageGrid',
    url:'cenum/queryCenum.action',
    editurl:'cenum/deleteCenum.action',
    datatype:'json',
    mtype:'get',
    colNames: [
    '枚举项序号','枚举类别名称','枚举项值','基本操作'
    ],
    colModel: [
               {name: 'ItemOrder', index: 'item_order',width: '100%',align: 'center',key:true},
               {name: 'EnumName', index: 'enum_name',width: '100%',align: 'center'},
               {name: 'ItemValue', index: 'item_value',width: '100%',align: 'center'},
               {name: 'operation', index : 'operation', width : '100%', align: 'center', sortable:false,search:false}
               
    ],
    height:275,
    pager: 'recordListManagePager',
    caption:'枚举定义表',
    toolbarName:'ctToolbar',
    btnHtml:singleRecordOper
    });JAVABEAN:
    StringBuffer stringBuffer = new StringBuffer();
    Map<String, Object> result = new HashMap<String ,Object>();
    stringBuffer.append("select * from c_enum ");
    if(cEnum != null && StringUtils.isNotEmpty(cEnum.getEnumName())){
    stringBuffer.append(" and enum_name like '%"+cEnum.getEnumName()+"%'");
    } try {
    PdbApiStub stub;
    try {
    stub = new PdbApiStub(Configure.URL);
    PdbApiStub.GetDataRecords2 request1 = new PdbApiStub.GetDataRecords2();
    request1.setSQuery(stringBuffer.toString());
    PdbApiStub.GetDataRecords2Response res = stub.GetDataRecords2(request1);
    ArrayList<Cenum> list = new ArrayList<Cenum>();
    List<String> l = Arrays.asList(res.getData().localItem);
    for(int i = 0; i <l.size() ;){
    Cenum cenum = new Cenum();
    String s = l.get(i++);
    cenum.setItemOrder(Integer.parseInt(s));
    cenum.setEnumName(l.get(i++));
    cenum.setItemValue(l.get(i++));
    list.add(cenum);
    }
    result.put("list", list);
    PdbApiStub.GetDataRecords2 request2 = new PdbApiStub.GetDataRecords2();
    request2.setSQuery("select COUNT(*) from c_enum");
    PdbApiStub.GetDataRecords2Response res2 = stub.GetDataRecords2(request2);
    String ds = res2.getData().localItem[0];
    int count = Integer.parseInt(ds);
    result.put("totalCount", count);
    return result;
    } catch (AxisFault e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }catch (RemoteException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }
    } catch (Exception e) {
    }
    return null;
      

  6.   

    估计你哪里出问题了,你确定你页面的数据出来了吗?alert();你debug了没?
      

  7.   

    后台list没有转换为json数据  
    JSONArray jsonList=JSONArray.fromObject(list);
      

  8.   

    我用action转成的json
         <action name="queryCenum" class="cenumAction" method="search">
         <result type="json"></result>
         </action>