Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/76.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typescript/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 如何选择行以启动表行扩展?_Html_Typescript_Primeng - Fatal编程技术网

Html 如何选择行以启动表行扩展?

Html 如何选择行以启动表行扩展?,html,typescript,primeng,Html,Typescript,Primeng,我正在处理表行扩展。我正在使用这个示例: 我试图使每个扩展行都被选中,但我失败了,我添加了此代码,但不起作用 <ng-template pTemplate="rowexpansion" let-rowData let-columns="columns" let-rowIndex="rowIndex"> <tr *ngFor="let subEvent of rowData.subEvents" [

我正在处理表行扩展。我正在使用这个示例: 我试图使每个扩展行都被选中,但我失败了,我添加了此代码,但不起作用

 <ng-template pTemplate="rowexpansion" let-rowData let-columns="columns" let-rowIndex="rowIndex">
<tr *ngFor="let subEvent of rowData.subEvents" [pSelectableRow]="subEvent[rowIndex]">
  <td [style.width.px]='40'></td>
  <td [attr.colspan]="columns.length">
    {{subEvent.code}}
  </td>
</tr>

{{subEvent.code}

任何帮助,请提前感谢。

您只需将
rowExpandMode=“single”
添加到
p-table
,默认值为
multiple

 <p-table [columns]="events.headers" [value]="events.data" dataKey="id" #eventTable
              selectionMode="single" [(selection)]="selectedEvent"
              (onRowSelect)="onRowSelect($event)" (onRowUnselect)="cancelUnselect($event)"
              (onRowExpand)="test($event)"
              rowExpandMode="single"
        >