Make DataTable into card grid

UI Components for Angular
Post Reply
bodyfarmer
Posts: 4
Joined: 21 Jun 2017, 21:41

23 Sep 2017, 04:29

DataTable Module has everything features I wanted (filter, reorder, scroll, etc) except I'm looking for a grid output.

Is there a good way to edit the table template to make it into divs?

Thanks.

User avatar
sudheer
PrimeFaces Core Developer
Posts: 4345
Joined: 16 Oct 2011, 19:19
Location: Singapore

24 Sep 2017, 07:34

Why can't you use dataGrid component
Author,Speaker
https://twitter.com/sudheerjonna
Github: https://github.com/sudheerj
Website http://sudheerjonna.com/

___________________
Sudheer Jonna

bodyfarmer
Posts: 4
Joined: 21 Jun 2017, 21:41

25 Sep 2017, 21:24

sudheer wrote:
24 Sep 2017, 07:34
Why can't you use dataGrid component
I'm under the impression that DataGrid Component does not have the filter, sort, editable, etc. options built in? Are they easy to implement?

Thanks

User avatar
sudheer
PrimeFaces Core Developer
Posts: 4345
Joined: 16 Oct 2011, 19:19
Location: Singapore

29 Sep 2017, 12:03

You are right. It doesn't make sense to have those features in dataGrid component. Have you tried to include Grid CSS styles in dataTable template.
Author,Speaker
https://twitter.com/sudheerjonna
Github: https://github.com/sudheerj
Website http://sudheerjonna.com/

___________________
Sudheer Jonna

bodyfarmer
Posts: 4
Joined: 21 Jun 2017, 21:41

30 Sep 2017, 18:06

I tried custom CSS on the table with some success. However, I'm not sure how to move the column filters outside of the DataTable? The global filter works outside of DataTable but column filters do not?

Also, with the popularity of Pinterest like grids, I think many ppl will greatly appreciate new features to the component.

paulswan
Posts: 94
Joined: 27 Apr 2017, 08:19

03 Oct 2017, 07:55

Column filters will work from outside the table. Here is an example of how you might do it:

Code: Select all

            <div class="ui-widget-header" style="padding:4px 10px; border-bottom: 0 none;">
                <i class="fa fa-search" style="margin:4px 4px 0 0"></i>
                <input type="text" pInputText size="50" placeholder="Year Filter" (change)="dt.filter(yearFilter.value,'year','contains')" #yearFilter>
            </div>
            <p-dataTable #dt [value]="cars1" selectionMode="single" [(selection)]="selectedCar"
                [paginator]="true" [rows]="10" [responsive]="true">
                <p-header>List of Cars</p-header>
                <p-column field="vin" header="Vin" [sortable]="true"></p-column>
                <p-column field="year" header="Year" [sortable]="true"></p-column>
                <p-column field="brand" header="Brand" [sortable]="true"></p-column>
                <p-column field="color" header="Color" [sortable]="true"></p-column>
            </p-dataTable>

bodyfarmer
Posts: 4
Joined: 21 Jun 2017, 21:41

03 Oct 2017, 21:15

paulswan wrote:
03 Oct 2017, 07:55
Column filters will work from outside the table. Here is an example of how you might do it:

Code: Select all

            <div class="ui-widget-header" style="padding:4px 10px; border-bottom: 0 none;">
                <i class="fa fa-search" style="margin:4px 4px 0 0"></i>
                <input type="text" pInputText size="50" placeholder="Year Filter" (change)="dt.filter(yearFilter.value,'year','contains')" #yearFilter>
            </div>
            <p-dataTable #dt [value]="cars1" selectionMode="single" [(selection)]="selectedCar"
                [paginator]="true" [rows]="10" [responsive]="true">
                <p-header>List of Cars</p-header>
                <p-column field="vin" header="Vin" [sortable]="true"></p-column>
                <p-column field="year" header="Year" [sortable]="true"></p-column>
                <p-column field="brand" header="Brand" [sortable]="true"></p-column>
                <p-column field="color" header="Color" [sortable]="true"></p-column>
            </p-dataTable>
That works! Thanks a ton.

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 18 guests