How to add multiple rows in datatables jquery

后端 未结 4 1305
旧时难觅i
旧时难觅i 2021-01-01 22:21

I have used https://datatables.net/reference/api/rows.add%28%29 link working but the data showing the table as [object,object]. How to show the object to string

4条回答
  •  不思量自难忘°
    2021-01-01 22:53

    I am returning a view as in a foreach loop, it returning multiple rows.now i ll append in datatable with all functionilities working of datatable.

    it work only when you are getting data in html format and only format of multiple rows.

    this is my datatable

       $('#SurveyDetails').dataTable({
        "scrollY": "500px",
        "scrollX": true,
        "scrollCollapse": true,
        "paging": false,
        "jQueryUI": false,
        "searching": false,
        "autoWidth": false,      
     });
    

    i am appending 30 rows on scroll of datatable.

    on sucess of ajax :

       success: function (data) {
                if (!$.trim(data) == '') {
    
                    data = data.replace(/^\s*|\s*$/g, '');
                    data = data.replace(/\\r\\n/gm, '');
                    var expr = "\\s*

提交回复
热议问题