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

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

select a grid row from a service

khayes1
13-Aquamarine

select a grid row from a service

Hi,

I have a mashup with a grid and a button. The button causes a popup which allows me to create a new entry for the grid. The grid is refreshed after the popup closes, but I would like the new row to be automatically selected.

would anyone know how that might be done. 

Note, I already return the primary key value for the new entry via a mashup parameter, just can't think of a way to use this to select the newly added row.

Does anyone know how I might do this?

 

Thanks,

K

16 REPLIES 16

The newly added data always come in first row, so does AutoSelectFirstRow checkbox work for you?

I think autoselect first row it's only applied the first time the grid loads, not when you refresh it, it won't work.

 

For the List Widget you can pass a selected value / selected text to the list and it will be selected ( not easy but feasible ), for grid you are out of luck, sometimes when I needed to do it what I did was to add a Hidden List Widget in companion with the Grid Widget (all bound to the same source) and you can do the trick on that way.

Hi Carles,

 

There's a button (probably a Navigation widget) in the mashup, and it will popup a window to insert information, when the window is closed, the Grid can be refreshed. If it doesn't work, the "window close event" can be used to trigger Mashup "Refresh" service.  So I still think the autoSelectFirstRow could help in here. 

But as I said, if you refresh the grid content (of course with the Popup close event) it wont go back to the first line. Also your approach won't work as the user may clicked on the columns and the grid order it's unexpected.

I just tested it in 8.2.2, either to trigger the Grid input service again or to refresh the whole mashup, the selected row will return to the first row.

What are you saying here it's only true when your datashape doesn't have a PrimaryKey field defined, if you have a PrimaryKey field defined (which it's the desired way of defining DataShapes) then your selected row will remain if you recall your data service (of course if you reload the whole mashup it will go back to first row).

khayes1
13-Aquamarine
(To:zyuan1)

Hi both,

thanks very much for your input. Unfortunately the first row solution wouldn't work for me as the grid data is sorted, so the new entry might not be the first row.

 

I think what I'm going to try is to use an infotable selector widget and the SelectRowNumber property. I'll then right a service which returns the row number my new entry is at and bid the result to the SelectRowNumber property.

Can you see any issues with that? 

 

Shame the infotable selector widget doesn't have a 'SelectText' property, similar to the list widget. 

K

What's Infotable Selector Widget?

 

But anyway, you can use may approach of having a hidden List Widget with the same content and bind the new selected row value to it, it will work.

khayes1
13-Aquamarine
(To:CarlesColl)

It is a widget that I use quite a lot. It is invisible at runtime, similar to validator widget etc. Thought it was a standard widget, maybe I got it from somewhere? It has some useful properties. You bid your infotable data to it. 

I tried to post a screenshot, but it wouldn't let me.

 

It's not standard as far as I know, look on your extensions you should find it there to know the origin.

khayes1
13-Aquamarine
(To:CarlesColl)

Yes, looks like I imported it, although it looks like it came from your organisation. Very useful, use it in lots of places.

My organitzation? I'm not a PTC employer ;)

khayes1
13-Aquamarine
(To:CarlesColl)

Sorry, just assumed that you were (as you know so much) :-).

Maybe you should give them a call, you're much better than their support team.

The author of the widget appears to be 'Thingworx Custom Service', although looking in the market place I can't find it now.

Yup you may got from them directly, I've never seen it on the marketplace (I usually keep track whats new and what's in there), really interesting one if you can share it would be wonderful :)

khayes1
13-Aquamarine
(To:CarlesColl)

This is the extension

 

WoW, thanks!

Top Tags