cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

How to prevent deselection of a row in a grid

Willie
16-Pearl

How to prevent deselection of a row in a grid

I've noticed that in TWX 9.5, a selected row is deselected when they are clicked on again.  How can I prevent this?  I don't want the row to be deselectable unless a different row is clicked on.

ACCEPTED SOLUTION

Accepted Solutions
Rocko
18-Opal
(To:Willie)

There is no direct way I know of.

What you can do though is to reselect the last selection when it gets unselected, because the SelectedRows property works in both directions.

so you bind SelectedRows as input and output of a "reselect" service which gets executed on RowsSelectionChanged.

The service does something like this:

if (!selRows||selRows.length==0) {
result=me.prevSelection;
} else {
me.prevSelection=selRows;
result=selRows;
}

 With me.prevSelection being an Infotable property of the same Datashape as your grid.

For this to be scalable, this would have to be a session variable instead of a thing property so it supports multiple users, but you get the idea.

It flickers a bit, but it does the trick.

View solution in original post

2 REPLIES 2
Rocko
18-Opal
(To:Willie)

There is no direct way I know of.

What you can do though is to reselect the last selection when it gets unselected, because the SelectedRows property works in both directions.

so you bind SelectedRows as input and output of a "reselect" service which gets executed on RowsSelectionChanged.

The service does something like this:

if (!selRows||selRows.length==0) {
result=me.prevSelection;
} else {
me.prevSelection=selRows;
result=selRows;
}

 With me.prevSelection being an Infotable property of the same Datashape as your grid.

For this to be scalable, this would have to be a session variable instead of a thing property so it supports multiple users, but you get the idea.

It flickers a bit, but it does the trick.

abandal
10-Marble
(To:Willie)

Hi @Willie,

 

It appears that this post may answer your question.  For the benefit of other Community Members who may have the same question, it would be great if you could designate it as the Accepted Solution.

In the event that this response did not answer your question, please post your current status so that we can continue to support.

Thanks for using the PTC Community!

Regards,
Abhi

Announcements


Top Tags