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

Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X

Is it possible to programmatically select a specific row in an infotable tied to a grid, so that the row will display as being selected in the grid?

jwilliams11
6-Contributor

Is it possible to programmatically select a specific row in an infotable tied to a grid, so that the row will display as being selected in the grid?

I have a mashup with a grid widget that displays an infotable populated by a SQL query.  The mashup also provides a date picker widget for the user to specify a new date value corresponding to the row selected in the aforementioned grid/infotable.  When the user clicks an "update" button next to the date picker to update the date for the selected item in the database, the change is made in the database, and then the SQL query is re-run to refresh the grid/infotable and show the updated date.  The issue is that when the grid/infotable is refreshed, the selected row changes to the first row displayed, as opposed to keeping focus on the row the user just changed.  This makes it difficult for the user to confirm that their update was applied, given that they may have to scroll the grid/infotable to find the item they updated.

I need to be able to programmatically select the row in the grid/infotable containing the item that the user just updated after the refresh occurs, so that they don't have to manually scroll to the item each time.  Is there any way to do this?

Thank you.

7 REPLIES 7
PaiChung
22-Sapphire I
(To:jwilliams11)

Try making the Date field or some of the other fields PRIMARY. I believe when a DataShape has Fields that are Primary, it retains the selected row.

Otherwise, a workaround is to add a List widget that is not visible and use the same DataSource and then set the SelectedValue on the List.

All other Widgets that display that sames DataSource information will all follow along with the Selection.

jwilliams11
6-Contributor
(To:PaiChung)

Pai,

Thank you!  Setting a column in my DataShape to Primary did the trick, without any additional code!  The focus within the grid stayed on the row that was previously selected even after the infotable was re-queried, which addresses the majority of my issue.  Very helpful!

The only remaining thing I'd like to do is have the grid vertically scroll to the row that is selected/in-focus after the infotable is re-queried, so that the selected row remains in view for the user and they don't have to scroll down the data in the grid to find it.  Do you know of a way to do this?

Thanks,

Jeff

PaiChung
22-Sapphire I
(To:jwilliams11)

I believe my second method will create that behavior. I can't be too sure, it's been a while.

jwilliams11
6-Contributor
(To:PaiChung)

Pai,

I wasn't able to find a "SelectedValue" list property you mentioned.  I did try passing the infotable data to both the "SelectedText" and "SelectedItems" list properties, but I didn't see any difference in the grid/infotable behavior.  Any other ideas?

Thanks,

Jeff

PaiChung
22-Sapphire I
(To:jwilliams11)

Then unfortunately I'm not too sure what would work.

Hi Jeff,

It’s working for me, please use dropdown instead of List and set “SelectedText”. That will automatically scroll and show selected record in Grid.


DropDown-SelectedText.JPG

Regards,

Lalit

I'm interested on the same as Jeff, Pai?

Top Tags