import { Component } from '@angular/core';
import {SelectItem} from "primeng/components/common/api";
@Component({
selector: 'my-app',
templateUrl: 'app/app.template.html'
})
export class AppComponent implements OnInit {
cars1: Car[];
brands: SelectItem[] = [];
ngOnInit() {
this.brands.push({value: "VW", label: "VW"});
this.brands.push({value: "Audi", label: "Audi"});
this.brands.push({value: "Renault", label: "Renault"});
this.brands.push({value: "BMW", label: "BMW"});
this.brands.push({value: "Mercedes", label: "Mercedes"});
this.brands.push({value: "Volvo", label: "Volvo"});
this.brands.push({value: "Honda", label: "Honda"});
this.brands.push({value: "Jaguar", label: "Jaguar"});
this.brands.push({value: "Ford", label: "Ford"});
this.brands.push({value: "Fiat", label: "Fiat"});
this.cars1 = [
{"brand": "VW", "year": 2012, "color": "White", "vin": "dsad231ff"},
{"brand": "VW", "year": 2013, "color": "Black", "vin": "dsad231ff"},
{"brand": "Audi", "year": 2011, "color": "Black", "vin": "gwregre345"},
{"brand": "Renault", "year": 2005, "color": "Gray", "vin": "h354htr"},
{"brand": "Renault", "year": 2000, "color": "Red", "vin": "h354htr"},
{"brand": "Renault", "year": 1990, "color": "Green", "vin": "h354htr"},
{"brand": "BMW", "year": 2003, "color": "Blue", "vin": "j6w54qgh"},
{"brand": "Mercedes", "year": 1995, "color": "White", "vin": "hrtwy34"},
{"brand": "Volvo", "year": 2005, "color": "Black", "vin": "jejtyj"},
{"brand": "Honda", "year": 2012, "color": "Yellow", "vin": "g43gr"},
{"brand": "Jaguar", "year": 2013, "color": "White", "vin": "greg34"},
{"brand": "Ford", "year": 2000, "color": "Black", "vin": "h54hw5"},
{"brand": "Fiat", "year": 2013, "color": "Red", "vin": "245t2s"}
]
}
customer = {"id": 1, "name": "Smith", "firstname": "John"};
customers = [
{"id": 1, "name": "Smith", "firstname": "John"},
{"id": 2, "name": "Doe", "firstname": "John"},
{"id": 3, "name": "Smith", "firstname": "Jane"}
];
customerResults: Array = [];
searchCustomers(event): void {
this.customerResults = this.customers.filter(c => c.name.startsWith(event.query));
}
}
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import {FormsModule} from '@angular/forms';
// Import PrimeNG modules
import { ButtonModule } from 'primeng';
import {DataTableModule} from 'primeng';
import {DropdownModule} from 'primeng';
import {AutoCompleteModule} from 'primeng';
@NgModule({
imports: [ BrowserModule, FormsModule, ButtonModule, DataTableModule, DropdownModule, AutoCompleteModule],
declarations: [ AppComponent ],
bootstrap: [ AppComponent ]
})
export class AppModule { }
/*
Copyright 2016 Google Inc. All Rights Reserved.
Use of this source code is governed by an MIT-style license that
can be found in the LICENSE file at http://angular.io/license
*/
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app.module';
const platform = platformBrowserDynamic();
platform.bootstrapModule(AppModule);
body {
padding: 2em;
font-family: Arial, Helvetica, sans-serif;
}
p-datatable.lf-p-dataTable table .ui-state-default{
background-color: #dee5ec !important;
height: 40px;
border: 0 solid #dee5ec;
border-left:1px solid #d9d9d9;
/*color: #205180;*/
}
p-datatable.lf-p-dataTable .ui-datatable .ui-sortable-column-icon{
color: #FFFFFF;
}
p-datatable.lf-p-dataTable .ui-column-title{
whitespace: pre-line;
font-size: 12px !important;
color: #205081 !important;
line-height: 18px;
font-weight: 700 !important;
}
p-datatable.lf-p-dataTable .ui-paginator{
text-align: right !important;
border: none;
background-color: transparent !important;
background: transparent !important;
}
p-datatable.lf-p-dataTable .ui-datatable .ui-datatable-thead>tr>th{
text-align: left !important;
}
p-datatable.lf-p-dataTable .ui-datatable .ui-datatable-data > tr > td,
p-datatable.lf-p-dataTable .ui-datatable .ui-datatable-tfoot > tr > td,
p-datatable.lf-p-dataTable .ui-datatable .ui-datatable-thead > tr > th{
border-color: #c4d0db !important;
}
p-datatable.lf-p-dataTable .ui-datatable tbody > tr.ui-widget-content:hover{
background-color: #b7e4f4 !important;
cursor: pointer;
}
p-datatable.lf-p-dataTable .ui-datatable-data .ui-widget-content{
color: #212121;
font-size: 12px;
}
p-datatable.lf-p-dataTable .ui-datatable tbody > tr.ui-widget-content{
line-height: 40px;
}
p-datatable.lf-p-dataTable .ui-datatable tbody > tr.ui-widget-content.ui-datatable-even{
background-color: #eff2f6;
}
p-datatable.lf-p-dataTable .ui-datatable tbody > tr.ui-widget-content.ui-state-highlight{
background-color: transparent !important;
color: #212121 !important;
}
/*p-autocomplete Styling starts from here...*/
p-autocomplete#lf-autocomplete .ui-inputtext{
color: #212121;
}
p-autocomplete#lf-autocomplete .ui-shadow{
box-shadow: none !important;
}
p-autocomplete#lf-autocomplete .ui-inputtext{
border-radius: 0 !important;
}
p-autocomplete#lf-autocomplete .ui-inputtext:enabled:hover{
border: 1px solid #55bee6 !important;
}
p-autocomplete#lf-autocomplete .ui-inputtext:focus{
box-shadow: none !important;
border: solid 1px #55bee6 !important;
}
p-autocomplete#lf-autocomplete .ui-state-default{
border: 1px solid #c4d0db !important;
}
p-autocomplete#lf-autocomplete .ui-state-default.ui-corner-all.ui-button-icon-only{
border-left: 0 !important;
/*border: none;*/
}
p-autocomplete#lf-autocomplete .ui-widget-content{
color: #212121 !important;
}
.ui-autocomplete-panel.ui-autocomplete-list{
padding: 5px !important;
}
.ui-autocomplete-items.ui-autocomplete-list.ui-widget-content.ui-widget.ui-corner-all.ui-helper-reset{
padding: 0px !important;
}
<!DOCTYPE html>
<html>
<head>
<title>Angular QuickStart</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="styles.css">
<!-- PrimeNG style dependencies -->
<link rel="stylesheet" href="https://unpkg.com/primeng@2.0.1/resources/themes/omega/theme.css" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" />
<link rel="stylesheet" href="https://unpkg.com/primeng@2.0.1/resources/primeng.min.css" />
<!-- 1. Load libraries -->
<!-- Polyfill for older browsers -->
<script src="https://unpkg.com/core-js/client/shim.min.js"></script>
<script src="https://unpkg.com/zone.js@0.6.25?main=browser"></script>
<script src="https://unpkg.com/reflect-metadata@0.1.8"></script>
<script src="https://unpkg.com/systemjs@0.19.39/dist/system.src.js"></script>
<!-- 2. Configure SystemJS -->
<script src="systemjs.config.js"></script>
</head>
<!-- 3. Display the application -->
<body>
<my-app>Loading...</my-app>
</body>
</html>
<!--
Copyright 2016 Google Inc. All Rights Reserved.
Use of this source code is governed by an MIT-style license that
can be found in the LICENSE file at http://angular.io/license
-->
/**
* WEB ANGULAR VERSION
* (based on systemjs.config.js in angular.io)
* System configuration for Angular samples
* Adjust as necessary for your application needs.
*/
(function (global) {
System.config({
// DEMO ONLY! REAL CODE SHOULD NOT TRANSPILE IN THE BROWSER
transpiler: 'ts',
typescriptOptions: {
// Copy of compiler options in standard tsconfig.json
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true
},
meta: {
'typescript': {
"exports": "ts"
}
},
paths: {
// paths serve as alias
'npm:': 'https://unpkg.com/'
},
// map tells the System loader where to look for things
map: {
// our app is within the app folder
app: 'app',
// angular bundles
'@angular/core': 'npm:@angular/core/bundles/core.umd.js',
'@angular/common': 'npm:@angular/common/bundles/common.umd.js',
'@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
'@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
'@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
'@angular/http': 'npm:@angular/http/bundles/http.umd.js',
'@angular/router': 'npm:@angular/router/bundles/router.umd.js',
'@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',
'@angular/upgrade': 'npm:@angular/upgrade/bundles/upgrade.umd.js',
'@angular/upgrade/static': 'npm:@angular/upgrade/bundles/upgrade-static.umd.js',
// other libraries
'rxjs': 'npm:rxjs',
'angular-in-memory-web-api': 'npm:angular-in-memory-web-api/bundles/in-memory-web-api.umd.js',
'ts': 'npm:plugin-typescript@4.0.10/lib/plugin.js',
'typescript': 'npm:typescript@2.0.3/lib/typescript.js',
'primeng': 'npm:primeng@2.0.0-rc.3/primeng.js'
},
// packages tells the System loader how to load when no filename and/or no extension
packages: {
app: {
main: './main.ts',
defaultExtension: 'ts'
},
rxjs: {
defaultExtension: 'js'
},
primeng: {
defaultExtension: 'js'
}
}
});
if (!global.noBootstrap) { bootstrap(); }
// Bootstrap the `AppModule`(skip the `app/main.ts` that normally does this)
function bootstrap() {
console.log('Auto-bootstrapping');
// Stub out `app/main.ts` so System.import('app') doesn't fail if called in the index.html
System.set(System.normalizeSync('app/main.ts'), System.newModule({ }));
// bootstrap and launch the app (equivalent to standard main.ts)
Promise.all([
System.import('@angular/platform-browser-dynamic'),
getAppModule()
])
.then(function (imports) {
var platform = imports[0];
var app = imports[1];
platform.platformBrowserDynamic().bootstrapModule(app.AppModule);
})
.catch(function(err){ console.error(err); });
}
// Import AppModule or make the default AppModule if there isn't one
// returns a promise for the AppModule
function getAppModule() {
if (global.noAppModule) {
return makeAppModule();
}
return System.import('app/app.module').catch(makeAppModule)
}
function makeAppModule() {
console.log('No AppModule; making a bare-bones, default AppModule');
return Promise.all([
System.import('@angular/core'),
System.import('@angular/platform-browser'),
System.import('app/app.component')
])
.then(function (imports) {
var core = imports[0];
var browser = imports[1];
var appComp = imports[2].AppComponent;
var AppModule = function() {}
AppModule.annotations = [
new core.NgModule({
imports: [ browser.BrowserModule ],
declarations: [ appComp ],
bootstrap: [ appComp ]
})
]
return {AppModule: AppModule};
})
}
})(this);
<p-dataTable class="lf-p-dataTable" #dt [value]="cars1" selectionMode="single" [(selection)]="selectedCar" [rows]="5" [paginator]="true" paginatorPosition="top" [pageLinks]="3" [rowsPerPageOptions]="[5,10,20]" [responsive]="true">
<!--<p-header>List of Cars</p-header>-->
<p-column field="vin" header="Vin" [sortable]="true">
<p-autoComplete [(ngModel)]="customer" [suggestions]="customerResults" (completeMethod)="searchCustomers($event)" field="name" placeholder="Hint: Filter on 'Smith' or 'Doe'" [dropdown]="true">
<ng-template let-customer pTemplate="item">
{{customer.name}} {{customer.firstname}}
</ng-template>
<ng-template let-customer pTemplate="selectedItem">
{{customer.name}} {{customer.firstname}}
</ng-template>
</p-autoComplete>
</p-column>
<p-column field="year" header="Year" [sortable]="true"></p-column>
<p-column field="brand" header="Brand" [sortable]="true" [style]="{overflow: 'visible'}">
<!--<template let-col pTemplate="filter">-->
<!-- <p-dropdown [appendTo]="body" [(ngModel)]="dropdownvalue" styleClass="ui-column-filter" [options]="brands" (onChange)="dt.filter(dropdownvalue,col.field,col.filterMatchMode)"></p-dropdown>-->
<!--</template>-->
</p-column>
<p-column field="color" header="Color" [sortable]="true"></p-column>
</p-dataTable>
# PrimeNG Issue Template
Please create a test case and attach the link of the plunkr to your github issue report.