Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ npm i @plcmp/pl-table

```html
<pl-table id="usersTable">
<pl-table-column header="Name" field="name" sortable tooltip-field="name"></pl-table-column>
<pl-table-column header="Email" field="email" tooltip-field="email"></pl-table-column>
<pl-table-column header="Name" field="name" sortable tooltip-field></pl-table-column>
<pl-table-column header="Email" field="email" tooltip-field></pl-table-column>
<pl-table-column header="Created" field="createdAt" kind="date" format="DD.MM.YYYY"></pl-table-column>
</pl-table>

Expand Down Expand Up @@ -74,7 +74,7 @@ Main public properties:

- `header: string` - header label
- `field: string` - row field path (supports dot notation)
- `tooltipField: string` - tooltip field path for cell hover
- `tooltipField: string` - tooltip field path for cell hover; when `tooltip-field` is present without a value, column `field` is used
- `kind: string` - value kind (`date` supported)
- `format: string` - date format when `kind="date"`
- `width: number` - column width in pixels
Expand All @@ -94,17 +94,27 @@ Tooltips are owned by each column and shown on cell hover (`mouseenter`).

### Option 1: `tooltip-field` (recommended)

Use a plain field path for tooltip text:
Use `tooltip-field` as a boolean attribute when tooltip text should come from the column `field`:

```html
<pl-table-column
header="Description"
field="description"
tooltip-field="description">
tooltip-field>
</pl-table-column>
```

Use this when tooltip text is the same as, or directly derived from, row data.
If tooltip text must come from a different path, provide it explicitly:

```html
<pl-table-column
header="Owner"
field="ownerCode"
tooltip-field="ownerName">
</pl-table-column>
```

Use this option when tooltip text is the same as, or directly derived from, row data.

### Option 2: custom tooltip template

Expand Down