DataTables add column dynamically to table

后端 未结 4 1820
星月不相逢
星月不相逢 2021-02-09 03:07

I\'m using DataTables (datatables.net) to display data from an Ajax source and having trouble customizing it. One thing I would like to do is add a column so I can have for exam

4条回答
  •  灰色年华
    2021-02-09 03:45

    Why don't you use fnRenderFunction in the aoColumns? As an example:

    aoColumns: [ { "bVisible": false} , null, null, null, null,
      { "sName": "ID",
        "bSearchable": false,
        "bSortable": false,
        "fnRender": function (oObj) {
           return "Edit";
         }
      }
    ]
    

    You can use it to format the value from the server side.

    See similar example on the http://jquery-datatables-editable.googlecode.com/svn/trunk/ajax-inlinebuttons.html (ignore specific settings for the editable plugin)

提交回复
热议问题