Skip to content

Filter selected rows #148

@Et3rnal

Description

@Et3rnal

I'm facing an issue with my implementation after the migration

Simply what I use to do is, I use userRowSelect event RowSelectionEvent to trigger a function that goes through a list and deselects anything that is not supposed to be selected with select all

What I use to do "before migrating to angular2-smart-table is

@ViewChild('table') table: Ng2SmartTableComponent;

    deselectActivityByUniqueId(uniqueId: string): void {
      let activity = this.table.grid.getSelectedRows().find(selectedRow => selectedRow.getData()["uniqueId"] == uniqueId);
      activity.isSelected = false;
    }

It seems getSelectedRows() is removed, what is the replacement ? getSelectedItems() ?

How can I achieve that? I look at the example which uses multipleSelectRow from onGridInit(data: DataSet) but I don't have the row inside RowSelectionEvent nor from Grid or DataSet

So how should I deselect?

I tried this

      let activityIndex = event.selected.findIndex(selectedRow => selectedRow.uniqueId == row.uniqueId);
      this.tableDataSet.select(activityIndex);
      //var rowToDeselect = this.tableDataSet.select(activityIndex);
      //if(rowToDeselect){
          //this.tableDataSet.multipleSelectRow(rowToDeselect);
          //event.source.toggleItem(rowToDeselect, false);
      //}

The table doesn't show the selected rows, but as soon as I navigate to another page everything appears to be selected

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestng2-smart-table-migrationAn issue that arised when migrating from the original ng2-smart-table to this fork.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions