Page 1 of 1

PrimeNg V12.1.0, frozenColumns Dynamically

Posted: 17 Mar 2022, 19:22
by RRG1993
How should it be declared to show frozen columns, when dynamically loaded, i try it like this but is not working

HTML

Code: Select all

<p-table
	#dt
	[columns] = "cols"
	[frozenColumns] = "frozen"
	[value] = "permisos"
	[autoLayout] = "true"
	[paginator] = "true"
	[rows] = "5"
	[showCurrentPageReport]="true"
	currentPageReportTemplate="{first} - {last} de {totalRecords} Registros"
	selectionMode="single"
	scrollDirection="both"
	[scrollable]="true"
	[rowsPerPageOptions]="[5,10,20]"
	styleClass="p-datatable-sm p-datatable-gridlines"
>
	<ng-template pTemplate="header" let-columns let-row="rowIndex">
		<tr>
			<th *ngFor="let col of cols" [pSortableColumn]="col.field" class="text-center">
				{{ col.header }}
				<p-sortIcon [field]="col.field"></p-sortIcon>
			</th>
		</tr>
		
	</ng-template>
</p-table>

TypeScript

Code: Select all

this.cols = {
	
	{field: 'b' , header: 'b'},
	{field: 'c' , header: 'c'},
	{field: 'd' , header: 'd'}, 
	{field: 'e' , header: 'e'},
	{field: 'f' , header: 'f'},
	{field: 'g' , header: 'g'},
	{field: 'h' , header: 'h'},
}
this.frozen = {
	{field: 'a' , header: 'a'},
}

Re: PrimeNg V12.1.0, frozenColumns Dynamically

Posted: 26 Oct 2022, 10:46
by sipesaidan
RRG1993 wrote:
17 Mar 2022, 19:22
the backrooms
How should it be declared to show frozen columns, when dynamically loaded, i try it like this but is not working

HTML

Code: Select all

<p-table
	#dt
	[columns] = "cols"
	[frozenColumns] = "frozen"
	[value] = "permisos"
	[autoLayout] = "true"
	[paginator] = "true"
	[rows] = "5"
	[showCurrentPageReport]="true"
	currentPageReportTemplate="{first} - {last} de {totalRecords} Registros"
	selectionMode="single"
	scrollDirection="both"
	[scrollable]="true"
	[rowsPerPageOptions]="[5,10,20]"
	styleClass="p-datatable-sm p-datatable-gridlines"
>
	<ng-template pTemplate="header" let-columns let-row="rowIndex">
		<tr>
			<th *ngFor="let col of cols" [pSortableColumn]="col.field" class="text-center">
				{{ col.header }}
				<p-sortIcon [field]="col.field"></p-sortIcon>
			</th>
		</tr>
		
	</ng-template>
</p-table>

TypeScript

Code: Select all

this.cols = {
	
	{field: 'b' , header: 'b'},
	{field: 'c' , header: 'c'},
	{field: 'd' , header: 'd'}, 
	{field: 'e' , header: 'e'},
	{field: 'f' , header: 'f'},
	{field: 'g' , header: 'g'},
	{field: 'h' , header: 'h'},
}
this.frozen = {
	{field: 'a' , header: 'a'},
}
Hey there, exact same problem too at my end. However, after double-checking, I believe there is nothing amiss. Have there been any updates on this?

Re: PrimeNg V12.1.0, frozenColumns Dynamically

Posted: 18 Nov 2022, 04:10
by wrestleyielding
I added a property isFrozenColumn in the column definition like thatspin the wheel and it worked perfectly

Re: PrimeNg V12.1.0, frozenColumns Dynamically

Posted: 27 Dec 2022, 10:55
by andree23
I was able to declare the columns visible, my error was fixed.
ovo

Re: PrimeNg V12.1.0, frozenColumns Dynamically

Posted: 23 Feb 2023, 05:44
by velcrogrow
Do you mean, non editable? if yes, then you can provide value to cell but in non-edited modedinosaur game. Ex. The pInputText that you used can be in disabled mode on certain conditions.

Re: PrimeNg V12.1.0, frozenColumns Dynamically

Posted: 28 Feb 2023, 10:02
by hena
To show frozen columns in a PrimeNG table that is dynamically loaded, you can use the [frozenColumns] input property of the p-table component.
drive mad