Sending JSON Objects in DataTables aaData instead of arrays

前端 未结 1 1416
日久生厌
日久生厌 2021-02-02 16:06

I am using the jquery DataTables plugin on my application and I am really happy so far with the functionality although I would like to pass the data slightly differently to the

1条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-02 16:54

    You can pass in the array of objects via aaData property, then use aoColumns property to define which column should recieve which data

      $('#example').dataTable({
            "bProcessing": true,
            "aaData": data,// <-- your array of objects
            "aoColumns": [
                { "mData": "render_engine" }, // <-- which values to use inside object
                { "mData": "browser" },
                { "mData": "platform" },
                { "mData": "enging_version" },
                { "mData": "css_grade" }
            ]
      });
    

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