0

Jquery データテーブルは jsonarray の値を解釈しません。テーブルに 1 文字しか表示されません。

<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を返します。

データを datatable に解釈する方法は?

4

1 に答える 1

2

テーブルに 2 つの列がある場合、データ入力として 2 つの要素配列の配列が必要です。

[["Element software", "descr1"], ["Software dist", "descr2"],
["Global envir", "descr3"], ["Software", "descr4"], ["Software list", "descr5"]]
于 2013-06-23T06:57:23.720 に答える