Skip to content

Commit

Permalink
fix(isct-59): fixed table component preselected rows
Browse files Browse the repository at this point in the history
  • Loading branch information
AndyKIron committed Sep 28, 2023
1 parent 8701043 commit 77a2fdd
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ import {
TABLE_STICKY_COLUMNS_CONFIG,
TABLE_SUBHEADER_COLUMNS_CONFIG,
ROWS_READONLY_ROW_DATA,
TABLE_TOGGLE_EDIT_COLUMNS_CONFIG
TABLE_TOGGLE_EDIT_COLUMNS_CONFIG,
TABLE_CHECKBOX_COLUMNS_CONFIG,
ROWS_CHECKBOX_DATA
} from './table.mock-data';
import {ApiService} from '@ironsource/fusion-ui';

Expand Down Expand Up @@ -1800,6 +1802,8 @@ export const InfinityScroll = {
render: TableInfinityScrollTemplate,

args: {
columns: TABLE_CHECKBOX_COLUMNS_CONFIG,
rows: ROWS_CHECKBOX_DATA,
options: {
...TABLE_DEFAULT_OPTIONS,
pagination: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const TABLE_SORTING_COLUMNS_CONFIG: TableColumn[] = [
{key: 'website', title: 'Website'}
];
export const TABLE_CHECKBOX_COLUMNS_CONFIG: TableColumn[] = [
{key: 'selected', type: TableColumnTypeEnum.Checkbox, width: '32px'},
{key: 'checkbox', type: TableColumnTypeEnum.Checkbox, width: '32px'},
...TABLE_DEFAULT_COLUMNS_CONFIG
];
export const TABLE_TOGGLE_COLUMNS_CONFIG: TableColumn[] = [
Expand Down Expand Up @@ -393,8 +393,8 @@ export const ROWS_TOTALS_DATA = [
},
...ROWS_DEFAULT_DATA
];
export const ROWS_CHECKBOX_DATA = ROWS_DEFAULT_DATA.map(row => {
return {selected: false, ...row};
export const ROWS_CHECKBOX_DATA = ROWS_DEFAULT_DATA.map((row, idx) => {
return {checkbox: idx == 3, ...row};
});
export const ROWS_TOGGLE_DATA = ROWS_DEFAULT_DATA.map(row => {
return {live: true, ...row};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ export class TableStoryHolderComponent implements OnInit, OnDestroy {
const newRows = Array.from({length: 20}, (_, i) => {
const id = i + shownLength + 1;
return {
checkbox: false,
id: id,
name: id + ' name',
username: id + ' UserName',
Expand Down
5 changes: 3 additions & 2 deletions projects/fusion-ui/components/table/v3/table.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,9 @@ export class TableComponent implements OnInit, OnDestroy {
public tableService: TableService,
private uniqueService: UniqueIdService,
private cdr: ChangeDetectorRef
) {}
) {
this.tableService.clearSelectedRows();
}

ngOnInit() {
this.searchFormControl = new FormControl(this.options?.searchOptions?.initalValue || '');
Expand All @@ -267,7 +269,6 @@ export class TableComponent implements OnInit, OnDestroy {
this.noDataSubMessage = this.options.noDataSubMessage || '';
this.hideHeaderOnEmpty = !isNullOrUndefined(this.options.hideHeaderOnEmpty) ? this.options.hideHeaderOnEmpty : false;
this.isAllRowsSelectable = typeof this.options.isAllRowsSelectable === 'undefined' ? true : this.options.isAllRowsSelectable;
this.tableService.clearSelectedRows();
this.scrollListeners();
this.configIconNames = CONFIG_TABLE_BY_UI_STYLE[`style_v2`];
this.wrapperClasses = this.getWrapperClasses();
Expand Down

0 comments on commit 77a2fdd

Please sign in to comment.