【问题标题】:JQuery table not interpreting the values , getting only one characterJQuery 表不解释值,只得到一个字符
【发布时间】:2013-06-23 06:20:44
【问题描述】:

Jquery 数据表未解释 jsonarray 值。我在表中只得到一个字符。,

<table border="1" cellspacing="0" cellpadding="0" id="products" style="clear:both;">
    <thead>
        <tr>
            <th>Product</th>
            <th>Description</th>
        </tr>
                     </thead>
      <tbody>
      </tbody>
     </table>  

来自服务器的实际数据格式:

["Element software","Software dist","Global envir","Software","Software list"] 

jquery 数据表代码:

 var oTable = $("#products").dataTable({
        "aaData" : data,
        "bProcessing" : true,
        "sPaginationType" : "full_numbers",
        "bJQueryUI" : true,
        "bRetrieve" : true,
        "bPaginate" : true,
        "bStateSave" : true,
        "bSort" : true,
        "aaSorting" : [[ 4, "desc" ]],
        "iDisplayLength" : 25,
        "oLanguage": {
        "sProcessing": "processing",
        "sEmptyTable": "No records found."
        }

        });

动作类:

     JSONArray ja = new JSONArray();
    try {
         Iterator it = List.iterator();
         while(it.hasNext()){
             SearchResult part = (SearchResult) it.next();
         ja.add(part.getlist1());
         ja.add(part.getlist2());
         findList.addAll(ja);
         }

返回findList,即arraylist。

如何将数据解释为数据表?

【问题讨论】:

    标签: jquery-ui jquery datatable datatables


    【解决方案1】:

    如果您的表中有 2 列,则需要一个包含 2 个元素数组的数组作为数据输入:

    [["Element software", "descr1"], ["Software dist", "descr2"],
    ["Global envir", "descr3"], ["Software", "descr4"], ["Software list", "descr5"]]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-05-21
      • 1970-01-01
      • 1970-01-01
      • 2021-10-20
      • 2014-05-23
      • 1970-01-01
      • 2021-10-05
      相关资源
      最近更新 更多