Releases: komarovalexander/ka-table
Add IsNotEqual filter operator to the Filter Row
add ability to set not equal filter row operator for the column:
filterRowOperator: '!='
Add isDraggable to disable Drag&Drop for specific column
<Table
//....
columns={[{
//...
isDraggable: false, // disable drag & drop for specific column
}]}
/>
Rows alternation styles (odd/even)
Header filter: Add search bar and improve customization
PR: #368
Questions: #415 #207 #187
New features
column.headerFilterSearchValue
stores value for search by headerFilterValuesheaderFilterSearch?: (value: any, searchValue: any, rowData?: any) => boolean;
- used to customize header filter search logicisHeaderFilterSearchable
- enables search in header filterchildComponents.filterRowCellInput
has been added for customizationchildComponents.headerFilterPopupSearchInput
has been added for customization- add new action
updateHeaderFilterSearchValue(columnKey: string, headerFilterSearchValue: string)
Breaking changes
- rename
headFilterButton
->headerFilterButton
- rename
popupContent
->headerFilterPopupContent
popupContentItem
has been deleted useheaderFilterPopupRow
insteadpopupContentItemText
&popupContentItemCellText
have been deleted, useheaderFilterPopupTextCell
instead
Add prevState to onDispatch
prevState
is useful when you need to get previous state of the table in onDispatch
const table = useTable({
onDispatch: (action, tableProps, prevState) => {
}
});
major version is updated as oldValue
has been removed from UpdateEditorValue
& UpdateCellValue
as not required anymore (oldValue
can be obtained from prevState)
Add cell oldValue info to build-in cell editing actions
oldValue
has been added to UpdateEditorValue
& UpdateCellValue
actions and updateEditorValue
& updateCellValue
action creators
#411
Performance improvement: column.dataType independent render
new major version as convertToColumnTypes
step was removed.
in previous versions convertToColumnTypes is used to check and convert all cells data to correct dataType of the column. As a result this affected performance of the whole table.
in version 9.0.0 user should check that correct dataType is set in column, for example:
'1' & 1 have different dataTypes starting from version 9.0.0. Column with value '1'
- should has String dataType, 1
- should has Number dataType.
if data has a column with value '1' - and user need it to behave it as a number, then this value should be converted to Number before passing to data, and column dataType should set as Number.
Pros:
Performance of the table is increased as no additional checks and conversions.
Cons:
Users should better care about dataTypes - but in most cases it is better to have more obvious behavior instead of having hidden conversion under the hood in the table
Add customReducer support to uncontrolled mode
const table = useTable({
customReducer: (nextState, action, prevState) => {
//...
return newState;
}
});
return (
<Table
table={table}
//...
/>
);
- also make more ITableProps functions as generics
Generic ITableProps
data
now has specific type, and you also can setup a type in table
<Table<DataType>
//...
data={data} // data array has type DataType[]
//...
childComponents={{
cellText: {
content: ({ rowData }) => {
//.. rowData has type DataType
}
}
}}
/>
What's Changed
- remove childComponents from onDispatch call by @komarovalexander in #395
- Bump webpack-dev-middleware from 5.3.3 to 5.3.4 by @dependabot in #396
- Make ITableProps a generic by @komarovalexander in #397
- Bump express from 4.18.2 to 4.19.2 by @dependabot in #398
Full Changelog: 8.10.0...8.11.0
ClearAllFilters action
To clear all filters just call table.clearAllFilters();
or clearAllFilters()