jQuery DataTables plugin: adding a checkbox dynamically

后端 未结 1 1347

When adding a row dynamically using jQuery DataTables plugin, what do I do if one of the cells has to be, say, a checkbox? Just put the HTML in quotes?

相关标签:
1条回答
  • 2021-01-03 03:12

    Ok now I know it is the plugin that I am using.

    I did mine on the server but you should just write the html in the column.

    I will try to make an example in a few minutes.

    This is how my checkbox comes from the server

    "CheckBox":"\u003cinput type=\"checkbox\"\u003e\u003c/input\u003e"
    

    However this should work

    dataTable.fnAddData(['<input type="checkbox" name="vehicle" value="Bike" />','SomeOtherDataForAnotherColumn']);
    
    0 讨论(0)
提交回复
热议问题