jquery DataTables - change value of a cell not just display value

后端 未结 2 674
無奈伤痛
無奈伤痛 2021-02-19 05:06

Using DataTables I want to change the value of the data before rendering the table. I used this:

\"fnRowCallback\": function( nRow, aData, iDisplayIndex ) {
             


        
相关标签:
2条回答
  • 2021-02-19 05:14

    You should probably paste some more of your code, especially the sorting area.

    It seems you're mixing up val() and html():

    This will get you the input or cell value as in the value tag "value=?"

    $("#currentRow").val()
    

    This will get you the actual html (data) between the tag "<td>data</td>"

    $("#currentRow").html()
    
    0 讨论(0)
  • 2021-02-19 05:32

    You need to update the datatable, not html.

    oTable.fnUpdate( newValue, rowPos, columnPos);
    

    assuming oTable is a reference to the datatable.

    0 讨论(0)
提交回复
热议问题