-
Notifications
You must be signed in to change notification settings - Fork 407
Guide to upgrade from 1.x to v2.0
xaksis edited this page Mar 4, 2018
·
8 revisions
The styles are now separated from the js component. This means it needs to be imported separately. This also means that if you don't want to use vue-good-table's styles, just don't include it 😄
to activate, use
theme="nocturnal"
for dynamic td templates the workings have changed to add IE support and to better meet the HTML specification. here's an example of how to do this now:
<vue-good-table
:columns="columns"
:rows="rows">
<template slot="table-row" slot-scope="props">
<span v-if="props.column.field == 'age'">
age: {{props.row.age}}
</span>
<span v-else>
{{props.formattedRow[props.column.field]}}
</span>
</template>
</vue-good-table>
- The original row object can be accessed via
props.row
- The currently displayed table row index can be accessed via
props.index
. - The original row index can be accessed via
props.row.originalIndex
. You can then access the original row object by usingrow[props.row.originalIndex]
. - The column object can be accessed via
props.column
- You can access the formatted row data (for example - formatted date) via
props.formattedRow
Some properties were removed
- title - title can easily be rendered outside the table. There's no good reason to have that as part of the table component especially since action-slot is now moved to the control-bar (next to global-search). Good Bye Title!
- filterDropdown - If filterDropdownItems is populated and is an array, we know to use a dropdown instead of an input. This boolean was not necessary and therefore was removed. Good-Bye!
I changed several property names to 1. follow recognizable patterns 2. to align them better with what they do. Here's a list:
table properties
Old Name | New Name |
---|---|
globalSearch | searchEnabled |
globalSearchFn | searchFn |
globalSearchPlaceholder | searchPlaceholder |
column properties
Old Name | New Name |
---|---|
inputFormat | dateInputFormat |
outputFormat | dateOutputFormat |
filterable | filterOptions.enabled |
filterValue | filterOptions.filterValue |
filter | filterOptions.filterFn |
placeholder | filterOptions.placeholder |
filterOptions | filterOptions.filterDropdownItems |
Event names were also changed to make them more consistent
Old Name | New Name |
---|---|
perPageChanged | on-per-page-change |
pageChanged | on-page-change |
- on-row-click - event emitted on row click
- on-search - event emitted on global search change
- on-column-filter - event emitted on column filter change
- on-sort-change - event emitted on sort change