在这种情况下,我在表中有一个数据列表。总列为三,其中一个为复选框。请参见下面
这是我的代码
Intent i = new Intent(Intent.ACTION_DIAL);
下面是当我单击“提交”按钮时发送到后端的预期结果
任何帮助将不胜感激。大家知道,我仍然没有在.ts文件中做任何逻辑。
答案 0 :(得分:0)
这是您要执行的操作的官方示例: https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/components/table/demo/row-selection.ts
import { Component } from '@angular/core';
@Component({
selector: 'nz-demo-table-row-selection',
template: `
<nz-table
#rowSelectionTable
[nzData]="data"
(nzCurrentPageDataChange)="currentPageDataChange($event)"
(nzPageIndexChange)="refreshStatus()"
(nzPageSizeChange)="refreshStatus()">
<thead>
<tr>
<th nzShowCheckbox [(nzChecked)]="allChecked" [nzIndeterminate]="indeterminate" (nzCheckedChange)="checkAll($event)"></th>
<th>Name</th>
<th>Age</th>
<th>Address</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of rowSelectionTable.data">
<td nzShowCheckbox [(nzChecked)]="data.checked" [nzDisabled]="data.disabled" (nzCheckedChange)="refreshStatus()"></td>
<td>{{data.name}}</td>
<td>{{data.age}}</td>
<td>{{data.address}}</td>
</tr>
</tbody>
</nz-table>`,
styles : []
})
export class NzDemoTableRowSelectionComponent {
allChecked = false;
indeterminate = false;
displayData = [];
data = [
{
name : 'John Brown',
age : 32,
address : 'New York No. 1 Lake Park',
checked : false,
disabled: false
},
{
name : 'Jim Green',
age : 42,
address : 'London No. 1 Lake Park',
checked : false,
disabled: false
},
{
name : 'Joe Black',
age : 32,
address : 'Sidney No. 1 Lake Park',
checked : false,
disabled: false
},
{
name : 'Disabled User',
age : 32,
address : 'Sidney No. 1 Lake Park',
checked : false,
disabled: true
}
];
currentPageDataChange($event: Array<{ name: string; age: number; address: string; checked: boolean; disabled: boolean; }>): void {
this.displayData = $event;
this.refreshStatus();
}
refreshStatus(): void {
const allChecked = this.displayData.filter(value => !value.disabled).every(value => value.checked === true);
const allUnChecked = this.displayData.filter(value => !value.disabled).every(value => !value.checked);
this.allChecked = allChecked;
this.indeterminate = (!allChecked) && (!allUnChecked);
}
checkAll(value: boolean): void {
this.displayData.forEach(data => {
if (!data.disabled) {
data.checked = value;
}
});
this.refreshStatus();
}
}