Compare
Puts offers or versions side by side.
kor/ui/CompareSource
When to use
- Use it for quotations, document versions and products.
Examples
Quotations
<k:Compare rows="{path: '/rows', templateShareable: false}">
<k:columns>
<k:CompareColumn key="a" title="Anadolu Metal" text="Current supplier"/>
<k:CompareColumn key="b" title="Ege Çelik" actionText="Choose"/>
<k:CompareColumn key="c" title="Nord Steel" actionText="Choose"/>
</k:columns>
<k:rows><k:CompareRow label="{label}" values="{values}" best="{best}" unit="{unit}" group="{group}"/></k:rows>
</k:Compare>
API
Properties
| Name | Type | Default | Description |
|---|
onlyDifferences | boolean | false | Whether to show only rows that differ |
toggle | boolean | true | Whether to show the differences switch |
label | string | | Accessible name |
baseline | int | 0 | Index of the baseline column. Use -1 for none |
Aggregations
| Name | Type | Description |
|---|
columns | CompareColumn[] | Things being compared |
rows | CompareRow[] | Fields |
Events
| Name | Type | Description |
|---|
columnPress | key: string | A column button was pressed |
Methods
| Name | Description |
|---|
differs(row: CompareRow): boolean | Whether the values of a row differ. |
CompareColumn
A comparison column.
Properties
| Name | Type | Default | Description |
|---|
key | string | | Key |
title | string | | Title |
text | string | | Subtitle |
statusText | string | | Status text |
state | string | | Status. Hidden when empty |
actionText | string | | Button text |
CompareRow
A comparison row.
Properties
| Name | Type | Default | Description |
|---|
label | string | | Field name |
values | any | | Values in column order |
group | string | | Group heading |
best | string | | Use min or max to mark the best number |
decimals | int | 0 | Decimal places |
unit | string | | Unit |
Related
PivotDetails