How use dataTable for table created with javascript?
How use dataTable for table created with javascript?
yefim
Posts: 3Questions: 2Answers: 0
I’m trying to use dataTable Plugin for table created with javascript, but with no success.
I would appreciate any help to find out where is my mistakes. Here is the code
= = = = =
@{
ViewBag.Title = "JStableTest";
}
javaScript tables created Test
<head>
<link rel="stylesheet" type="text/css" href="//cdn.datatables.net/1.10.2/css/jquery.dataTables.css">
Name | title | Duration | % Complete | Finish | |
---|---|---|---|---|---|
').html(of[0]); tRow.append(tCell); tCell = $(' | ').html(of[1]); tRow.append(tCell); tCell = $(' | ').html(of[2]); tRow.append(tCell); tCell = $(' | ').html(of[3]); tRow.append(tCell); tCell = $(' | ').html(of[4]);
tRow.append(tCell);
$tbody.append(tRow);
});
}
catch (e) {
e.message();
}
$table.appendTo('#demo');
//
$('#example').dataTable(
{
paging: false,
scrollX: true,
scrollY: 400,
});
};
</head> |
This discussion has been closed.
Answers
Sorry for bothering.
Here is solution:
$('#example').dataTable( {
paging: false,
scrollX: true,
scrollY: 400, });
Replaced with
jQuery($table).dataTable({
paging: false,
scrollX: true,
scrollY: 200,
});