DataTable responsive

UI Components for Angular
Post Reply
vittorio
Posts: 10
Joined: 11 Mar 2016, 16:13

27 Mar 2016, 09:21

Hello,
i've a problem with the datatable responsiveness.
Usually the table is
Image
but when i reduce the size of the window...
Image
which isnt what it is supposed to do.

I've the last version of primeng/primeui with the right imports.
My code:

Code: Select all

<p-dataTable    [value]="sessions" 
                                selectionMode="single" 
                                [responsive]="true"
                                [rows]="5" [paginator]="true" [pageLinks]="3"
                                (onRowSelect)="onRowSelect($event)" >
                        <header>Client Sessions</header>
                        <p-column field="session_info.Device" header="Device" 
                                    [sortable]="true" [filter]="true" filterMatchMode="contains"></p-column>
                        <p-column field="session_info.type" header="Type" 
                                    [sortable]="true" [filter]="true" filterMatchMode="contains"></p-column>
                        <p-column field="session_info.search_filters.query" header="Query" 
                                    [sortable]="true" [filter]="true" filterMatchMode="contains"></p-column>          
                </p-dataTable

Code: Select all

@Component
({
	selector: 'my-app',
	templateUrl: "scripts/spa/templates/session-app.component.html",
    styleUrls: ["scripts/spa/styles/common.css"],
	directives: [ DataTable, SessionDetail, Fieldset, Column, Header ],
})
export class ClientSessionsComponent implements AfterViewInit
{
    title = 'SessionApp';
    sessions: Session[];
    selectedSession: Session;

    constructor(private _sessionService: SessionService) { }

    ngAfterViewInit() 
    {
        this._sessionService.getSessions().subscribe(sessions => this.sessions = sessions );
        
    }
    
    onRowSelect(event)
    {
        this.selectedSession = event.data;
        window.console.log(this.selectedSession);
    }
}
I can't get what i am doing wrong

cagatay.civici
Prime
Posts: 18478
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

27 Mar 2016, 09:58

Do you have doctype at your html?

vittorio
Posts: 10
Joined: 11 Mar 2016, 16:13

27 Mar 2016, 10:03

optimus.prime wrote:Do you have doctype at your html?
Nope
EDIT: i added <!DOCTYPE html> and now works, i didnt know it was necessary :o
Image

Thanks a lot :)
and Happy Easter !

cagatay.civici
Prime
Posts: 18478
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

28 Mar 2016, 16:38

Awesome, I had the same issue in the past and doctype fixed it as well. Happy easter.

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 11 guests