Can't getSelectedIndex, nor setSelectedIndex, in PowerGrid

Questions and answers on designing your Servoy solutions, database modelling and other 'how do I do this' that don't fit in any of the other categories

Can't getSelectedIndex, nor setSelectedIndex, in PowerGrid

Postby ellenmeserow » Thu Jan 16, 2020 2:19 am

controller.getSelectedIndex always returns 0, even when (as in attached) we are clearly selecting a non-zero row. Can't setSelectedIndex either. We are in 2019.9. Help?

Screen Shot 2020-01-15 at 4.22.38 PM.png
Screen Shot 2020-01-15 at 4.22.38 PM.png (97.39 KiB) Viewed 2186 times
ellen escarcega (formerly meserow)
meserow design
Servoy 2019 9
MSSQL 2017
Windows AWS Servers
ellenmeserow
 
Posts: 366
Joined: Sat Aug 07, 2004 10:18 pm
Location: Seattle, WA USA

Re: Can't getSelectedIndex, nor setSelectedIndex, in PowerGr

Postby Andrei Costescu » Wed Jan 22, 2020 2:42 pm

controller. ... works with the foundset of the form.

A Data Grid might use the form's foundset (or a different one could be chosen in designer). If it's the same foundset as the form then what you are trying to do should work. Otherwise you should use the foundset from the component "elements.mydatagrid.myFoundset. ..."

But you are using Power Grid which is based on datasets, not on foundsets. So in that case you have to use the API/events/properties of the component itself. I see Power Grid currently has "getSelectedRows", "multiselect" and "onRowSelected". Not sure if those are enough for you or not.
Andrei Costescu
Servoy
Andrei Costescu
 
Posts: 1018
Joined: Tue Jun 26, 2007 3:14 pm

Re: Can't getSelectedIndex, nor setSelectedIndex, in PowerGr

Postby ellenmeserow » Sat Jan 25, 2020 1:15 am

Hi Andrei,



I have attempted to use the controller and the elements foundset to select the rows but both seem to be ignored. As you point out powergrid uses a dataset and not a foundset and I think this might be the root of the issue we are seeing.

We have two issues were trying to solve.

1) We want to select a specific row on data load or some event.
2) keep the selected row when we need to reload the data in the grid.

We were able to solve the second issue by adding a property to the current powergrid that accepts a function to set the getRowNodeId function of ag-grid and setting the deltaRowDataMode option to true. But we still have the issue where we would like to set a specific row to selected on load or some other event. As far as I can tell there doesn’t seem to be a way to do that with the current grid.

Any advice would be appreciated.



Thanks,

Ellen
ellen escarcega (formerly meserow)
meserow design
Servoy 2019 9
MSSQL 2017
Windows AWS Servers
ellenmeserow
 
Posts: 366
Joined: Sat Aug 07, 2004 10:18 pm
Location: Seattle, WA USA

Re: Can't getSelectedIndex, nor setSelectedIndex, in PowerGr

Postby Andrei Costescu » Sat Jan 25, 2020 1:29 am

Ok. Please create a feature request for the Powergrid to allow setting the selected row from code.
That is the only thing that is missing for what you need now right?
Andrei Costescu
Servoy
Andrei Costescu
 
Posts: 1018
Joined: Tue Jun 26, 2007 3:14 pm


Return to Programming with Servoy

Who is online

Users browsing this forum: Bing [Bot] and 9 guests