2014-08-29 3 views
0

누군가가이 문제를 해결할 수 있기를 바랍니다. 이전 버전의 datatables.net으로 기존 응용 프로그램을 찾고 있습니다. 함수를 사용하여 데이터 테이블을 채우고 반환 된 이름을 기반으로 행에 색상을 추가합니다. 아래 코드가 작동합니다.jQuery datatable - 셀 값 변경

$(function() { 

$("#ProfileTable").dataTable({ 
    "bProcessing": true, 
    "bServerSide": true, 
    "bFilter": false, //Hide the search box 
    "bInfo": false, 
    "bPaginate": false, 
    "bLengthChange": false, 
    "sAjaxSource": 'DataTableHandler.ashx?dataTableId=ProfileTable', 
    "aoColumns": [ //aoColumns defines the properties of the table columns 
        { 
         "mDataProp": "Name", 
         "fnRender": function (o) { 
          return SetToolTip(o); 
         } 
        }, 
        { 
         "mDataProp": "DollarValue", 
         "fnRender": function (o) { 
          return accounting.formatMoney(dollarValue); 
         } 
         , 
         "bUseRendered": false, 
         "sClass": "dataTableTextAlignRight" 
        } 
    ], 
    "fnRowCallback": function (nRow, aData, iDisplayIndex, iDisplayIndexFull) { 

     //Highlight the row colors based on the Name. It must be identical to what is being retrieved from the database 
     var columnData = aData["Name"]; 
     var div = document.createElement("div"); 
     div.innerHTML = columnData; 

     if (div.innerText == "TOYS" { 
      $('td', nRow).css('background-color', '#E0E0E0'); 
     } 

     if (div.innerText == "LOST TOYS") { 
      $('td', nRow).css('background-color', '#BDBDBD'); 
     } 
    } 
} 

내가 뭘에 문제가 있습니다 : 이름 = "손실 TOYS"및 DollarValue = 0 다음 빈 문자열로 표시 할 DollarValue를 변경하는 경우 (즉, 셀에 표시 값이 없음).

fnUpdate를 사용하여 보았지만 올바른 행과 열을 읽을 수 없습니다. 그것은 "정의되지 않은"것으로 돌아옵니다.

모든 의견을 크게 환영합니다. 덕분에 !

답변