Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/28.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
Angular 正在初始化分组中的p表列大小调整不起作用_Angular_Html Table_Angular6_Primeng - Fatal编程技术网

Angular 正在初始化分组中的p表列大小调整不起作用

Angular 正在初始化分组中的p表列大小调整不起作用,angular,html-table,angular6,primeng,Angular,Html Table,Angular6,Primeng,正在初始化的p表可调整大小的列问题 {{col?.header} {{副标题?.header} {{columnValue[sub.field]} {{columnValue[col.field]} 列列表如下所示 列列表=[ { 标题:“标题1”,字段:“标题1”,副标题:[ {标题:“subheader1”,字段:“subheader1”}, {标题:“subheader2”,字段:“subheader2”} ] } ] groupHeaderColSpan=[ {字段:'subheade

正在初始化的p表可调整大小的列问题


{{col?.header}
{{副标题?.header}
{{columnValue[sub.field]}
{{columnValue[col.field]}
列列表如下所示
列列表=[
{
标题:“标题1”,字段:“标题1”,副标题:[
{标题:“subheader1”,字段:“subheader1”},
{标题:“subheader2”,字段:“subheader2”}
]
}
]
groupHeaderColSpan=[
{字段:'subheader1',宽度:'100',子项:2}
]
我想将重新调整大小的列应用于表,因此我已经应用了 但它不能正常工作,因为我增加了特别的宽度 但它会增加另一列的宽度

在第二幅图中,我试图增加垫子列的宽度,但它增加了子列的宽度

 <p-table [resizableColumns]="true" columnResizeMode="expand" [value]="data" sortMode="multiple" [style]="{width:'100%'}" [scrollable]="true" [scrollHeight]="height" [columns]="columnList" (onColResize)="onBusinessLogicTableColResize($event)">
      <ng-template pTemplate="colgroup" let-columns>
        <colgroup>
          <col *ngFor="let col of groupHeaderColSpan" [style.width]="col.width + 'px'">
        </colgroup>
      </ng-template>
      <ng-template pTemplate="header" let-columns>
        <tr class="text-center">
          <th *ngFor="let col of columnList" [colSpan]="col.colSpan" [rowSpan]="col.rowSpan" pResizableColumn>
            {{col?.header}}
          </th>
        </tr>
        <tr class="text-center">
          <ng-template ngFor let-col [ngForOf]="columnList">
            <th *ngFor="let subheader of col?.subheaders" [colSpan]="subheader.colSpan" [rowSpan]="subheader.rowSpan">
              {{subheader?.header}}
            </th>
          </ng-template>
        </tr>
      </ng-template>
      <ng-template pTemplate="body" let-columnValue let-rowIndex="rowIndex" let-columns="columns">
        <ng-template ngFor let-col [ngForOf]="columns">
          <ng-template [ngIf]="col.hasOwnProperty('subheaders')" [ngIfElse]="showData">
            <td class="ui-resizable-column" *ngFor="let sub of col.subheaders" class="text-center">
              {{columnValue[sub.field]}}
            </td>
          </ng-template>
          <ng-template #showData>
            <td class="ui-resizable-column">
              {{columnValue[col.field]}}
            </td>
          </ng-template>
        </ng-template>
        </tr>
      </ng-template>
    </p-table>





    The column list will be like this 
         columnList = [
            {
              header: "header1", field: "header1", subheaders: [
                { header: "subheader1", field: "subheader1" },
                { header: "subheader2", field: "subheader2" }
              ]
            }
          ]


    groupHeaderColSpan = [
    { field: 'subheader1', width: '100', child: 2 }
    ]