primeng

PrimeNG datatable checkbox selection with pagination

狂风中的少年 提交于 2020-01-01 05:29:10
问题 I'm trying to bring a data table layout with pagination that has checkbox selection for data in it. I'm able to select a page's data and when I move to another page, and select different set of data, the first page selection is lost. demo.html: <p-dataTable [value]="cars" [rows]="10" [paginator]="true" [pageLinks]="3" [rowsPerPageOptions]="[5,10,20]" sortMode="multiple" [(selection)]="selectedCars2"> <p-column [style]="{'width':'38px'}" selectionMode="multiple" ></p-column> <p-column field=

how to initialize primeng tree component

痴心易碎 提交于 2020-01-01 01:24:46
问题 Given a tree how to initialize it in such way that the nodes are expanded at will? I already tried to get a reference with @ViewChildren(Tree) tree but is resulting in undefined references when trying to access his children 回答1: This is a hack that basically simulates clicks along the tree. I add this solution but I really hope someone could find something better. Given a component with a tree we can get a reference to the treenodes and then "click" them as necessary: @Component({ selector:

How to get rid of the 'No records found message' in PrimeNG datatable?

我的梦境 提交于 2019-12-30 10:34:11
问题 I created a data table using PrimeNG. I just created 2 headings for the datatable. I'll actually fetch the data from the server, hence if there is no data I do not want the default 'No records found message' to be shown. I would like the table to be empty if there is no data in the table. Please take a look at the table that I have created below : <p-dataTable> <p-headerColumnGroup > <p-row> <p-column header="Weekday"></p-column> <p-column header="Set Class Time"></p-column> </p-row> </p

Angular 2 - PrimeNg style not working

会有一股神秘感。 提交于 2019-12-30 04:31:07
问题 I've followed the instruction to install primeng by running npm install primeng --save then importing what I need in the app.module.ts file, for example: import {CheckboxModule} from 'primeng/primeng'; ... imports: [ CheckboxModule, ],... I then add the style sheets to the index.html file: <head> ... <link rel="stylesheet" type="text/css" href="../node_modules/primeng/resources/themes/omega/theme.css" /> <link rel="stylesheet" type="text/css" href="../node_modules/primeng/resources/primeng

How to close the p- calender after selecting date in angular2

别等时光非礼了梦想. 提交于 2019-12-25 18:24:38
问题 I have used prime ng calender, when i select the date, the calender is not closing How do i close the calender after selecting date. HTML: <p-calendar [monthNavigator]="true" [yearNavigator]="true" yearRange="1910:2020" showButtonBar="true" showTime="true" dateFormat="mm-dd-yy" placeholder="mm-dd-yyyy" formControlName="End" [minDate]="yesterday" class="pull-left"></p-calendar> For reference i am adding link https://stackblitz.com/edit/angular-vjupfn?file=src%2Fapp%2Fapp.module.ts 回答1: Example

NG2 duplicate module name

一世执手 提交于 2019-12-25 09:16:30
问题 Using ng2 calendar module from PrimeNG (link) and open source calendar. import {CalendarModule} from "primeng/components/calendar/calendar"; import {CalendarModule} from 'angular-calendar'; How can I import both modules into mine? Now TS says Duplicate identifier 'CalendarModule'. 回答1: You can give an alias in typescript import. Try import { CalendarModule as c } from "primeng/components/calendar/calendar"; 来源: https://stackoverflow.com/questions/41393856/ng2-duplicate-module-name

PrimeNg Datatable style a cell

末鹿安然 提交于 2019-12-25 08:48:28
问题 I'm using the PrimeNg Datatable as follows and I need to put a specific css class to each cell I'm able to pass the css class as [class]="cssClassName" coming from the model but the class is only applied when the control is focused. Is it there a way to apply the class without the need of focus the control? Thanks in advance. The example is like it appears on the documentation <p-dataTable [value]="cars" [editable]="true" resizableColumns="true"> <p-column *ngFor="let col of cols, let c =

Prime-NG Confirm Dialog: Hide the Button after Confirmation

别等时光非礼了梦想. 提交于 2019-12-25 03:14:56
问题 I'm struggling with a problem using Angular and PrimeNG. There is an Input Field for weight allowing numbers up to 150. If the typed in value is greater than 150, a Confirm Button appears below the Input Field. If this button is clicked, the Confirm Dialog pops up, asking "Are you sure?". It contains two buttons to choose from, "Yes" and "No". 1.) Choosing "No" should close the Confirm Dialog and delete the previously typed-in value in the input field (this works). The Confirm Button shall

PrimeNG Toast not displaying after first API call

♀尐吖头ヾ 提交于 2019-12-25 02:23:09
问题 Steps: 1. Click save button 2. Data is saved and returns true 3. runs the code this.messageService.add({severity: "success", summary: "Success Message", detail: "Order submitted"}); expected result -> toast message shows actual result -> toast does not show UNTIL i click on the page (anywhere on the page). Below is what I have tried : this.test.getdata(this.id).subscribe(res=> { if(res.id == 0) { this.zone.run(() => { this.messageService.add({ key: 'custom', severity: 'info', summary:

Cannot set Content-Type in Angular FileUpload control

大憨熊 提交于 2019-12-25 00:09:44
问题 I have an PrimeNG FileUpload control in my Angular project and I manually invoke upload method as shown on PrimeNG manually invoke FileUpload. However, although I have properly fill the files parameter with file data, the data lost its value and returns null after passing from service.ts to Controller (ASP.NET MVC). I think the problem is caused by not being able to set Content-Type in none of the events as shown below: onBeforeSendFile(event: any) { event.xhr.setRequestHeader('X-Requested