Pav*_*vel 1 javascript datatable jquery datatables
我正在尝试将单击事件添加到动态创建的数据表中。这是我的js:
$('#report-table').dataTable({
"proccessing": true,
"serverSide": true,
"ajax": {
url: '@Url.Action("Get","Controller")',
type: 'GET'
},
"columns": [
{ "data": "Name" },
{ "data": "Date" }, //lest say I want to add a click event here ???
{ "data": "sName", render: myRender }// I tried render but this is rendered without waiting on click function
]
});
Run Code Online (Sandbox Code Playgroud)
例如,这是我的表:
<tr role="row" class="odd">
<td class="sorting_1">A Test</td>
<td class="aaaa">2/13/2020 3:34:40 PM</td> //lets say I want to fire a click event when I click the .aaaa class
<td>
<a asp-route-fileid="55555555" asp-action="Download5"><img src="img/download.svg" height="30" width="30"></a>
</td>
Run Code Online (Sandbox Code Playgroud)
假设我想在单击 .aaaa 类时触发单击事件。
谁能给我一个主意吗?我可以这样做吗?我被困在这里了。任何想法都会非常非常感激:)
小智 7
尝试一下,更多信息请查看此论坛:
$('#report-table').on('click', 'td.className', function (e) {
// your code to do something
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
14949 次 |
| 最近记录: |