2012-05-24 2 views
1

jQuery DataTables 그리드가있는 기본 html 페이지가 있습니다. 나는 브라우저에서jQuery DataTables 플러그인에 사용자 정의 행을 추가하는 방법

http://datatables.net/index

그것은 표시에 잘 수 있어요. 문제는 각 섹션에 사용자 지정 행 머리글을 추가하려는 것입니다. 행 헤더는 행 3, 행 8에 위치 할 수 있습니다. 어떻게 데이터 테이블 중간에 행 헤더를 동적으로 삽입합니까?

getDataOverview: function ($page) { 
     $page.find('#tblDataTable').dataTable({ 
      "bServerSide": true, 
      "fnDrawCallback": onAfterTableLoad, 
      "bJQueryUI": false, 
      "bFilter": false, 
      "bPaginate": false, 
      "bLengthChange": false, 
      "oLanguage": { "sInfo": "" }, 
      "sAjaxSource": this.getUrl($page) + '/GetDataOverview/', 
      "fnServerData": function (sSource, aoData, fnCallback) { 

       $.ajax({ 
        dataType: 'json', 
        type: "POST", 
        url: sSource, 
        data: aoData, 
        success: fnCallback, 
        error: function (jqXHR, textStatus, errorThrown) { alert('Error getting data' + errorThrown) } 
       }) 
      }, 
      "bProcessing": false, // don't want to use the default progress indicator at this time 
      "aoColumnDefs": [ 
       { "sName": "ID", "aTargets": [0], "mDataProp": "ID", "bSortable": false }, 
       { "sName": "Name", "aTargets": [1], "mDataProp": "Name", "bSortable": false }, 
       { "sName": "Other", "aTargets": [2], "mDataProp": "Other", "bSortable": false } 
      ], 
      "aaSorting": [[0, "asc"]] // default sort by Task Type 
     }); 
    }, 

답변

1

체크 아웃 fnRowCallback을 확인하십시오. 콜백 중에 헤더를 추가 할 행을 결정한 다음 조건에 맞는 새 행을 삽입 할 수 있습니다.

관련 문제