Question: datatable draw multiple rows using for loop

Question

datatable draw multiple rows using for loop

Answers 0
Added at 2017-01-02 10:01
Tags
Question

I have data table for user Reports, having columns Report Id,Report Title,created date,created by. I have a list for Users who created these reports. If i logged in as admin , only admin created list should display. So I used for loop and code is like this.

var sub="@User.Identity.Name.Split('|')[0]";
sub = sub.toLowerCase();
var ListUser= @Html.Raw(Json.Encode(Model.ListUser));
for ( i = 0; i < ListUser.length; i++) {
    if (ListUser[i].UserName.toLowerCase() == sub) {
        //// code to draw table
    }
}

I added table.column(0).search(ListUser[i].ReportID).draw(); But it will show only latest row. How to loop and draw table ?

Please help me here....

Answers to

datatable draw multiple rows using for loop

Source Show
◀ Wstecz