Skip to content
This repository has been archived by the owner on Dec 4, 2019. It is now read-only.

how to set a row as selected programmatically #270

Open
TanyaLi opened this issue Jan 24, 2017 · 2 comments
Open

how to set a row as selected programmatically #270

TanyaLi opened this issue Jan 24, 2017 · 2 comments

Comments

@TanyaLi
Copy link

TanyaLi commented Jan 24, 2017

Hi,
I'm using swimlane datatable in angular 2 ( with node.js), my datatable is like this:

<swui-datatable class='datatable material dark' id='dtMessage' [rows]='messages' [headerHeight]="0"
[rowHeight]="'65px'"
[externalPaging]="false" [limit]="10" [columnMode]="'flex'" [selectionType]="'single'">
<swui-datatable-column name="" [sortable]="false" [flexGrow]="3">

<div (click)="onSelect(row.messageId)">

{{row.messageSubject}}-{{row.messageRefNum}}

{{row.messageOverview}}




my page has a list in the left panel, and item details shown in the right panel.
After click on delete button in the right panel, the current selected item is deleted, and then set the previous/next item in the list as selected by default and show its details in the right panel.

i've achieved all the features except not sure how to set an item in the list (datatable) as selected by code.

tried added something like this: [class.active]="row.messageId === currentSelectedMesId" to tag : but at this point, there is no 'row'.

please advise.

Regards & Thanks,
Xiaohui Li.

@TanyaLi TanyaLi changed the title how to set a row as selected by code how to set a row as selected programmatically Jan 24, 2017
@TanyaLi
Copy link
Author

TanyaLi commented Jan 24, 2017

some html in the datatable were not being shown , template is used within the < swui-datatable-column > tag as :
'< template let-row="row" swui-datatable-cell-template > <div...>...'

@JimmyKuruvilla
Copy link

Hi Tanya,

I had the same need. This is a fork of the select codepen demo: http://codepen.io/anon/pen/dvVJgj

Adding a reference to the selected item into the selected array worked for me

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants