在DataTables插件中,我有下面的component.html代码,可以正常工作。选择行并单击“删除”按钮时,将调用handleDelete()
函数。我不知道如何将选定的行传递到handleDelete()
。我发现使用DataTables Editor example使用jQuery定义了我想发送的内容,但是我更喜欢只使用a5代码。我尝试命名表,并使用[[ngModel)]参数,但这会导致编译错误。
jQuery parameter
var rows = table.rows( {selected: true} ).indexes();
component.html
<sa-datatable
[options]="{
data: sysMsgs,
columns: [
{data: 'checked'},
{data: 'rowid'},
{data: 'senderID'},
{data: 'message'},
{data: 'dateCreated'}
],
buttons: [ 'copy', 'csv', 'pdf', 'print',
{
extend: 'selected',
text: 'Delete',
action: handleDelete()
}
],
columnDefs: [
{
targets: 0,
orderable: false,
className: 'select-checkbox'
},
{
targets: [2],
visible: true
}
],
select: {
style: 'os',
selector: 'td:first-child'
},
order: [[ 1, 'asc' ]],
searching: true,
search: {
smart: false
}
}"
tableClass="table table-striped table-bordered table-hover">
<thead>
<tr>
<th data-hide="mobile-p">Select</th>
<th data-hide="mobile-p">ID</th>
<th data-hide="mobile-p">Sender</th>
<th data-hide="mobile-p">Message</th>
<th data-hide="mobile-p">Date Sent</th>
</tr>
</thead>
</sa-datatable>