Can't getSelectedIndex, nor setSelectedIndex, in PowerGrid

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?

[attachment=0]Screen Shot 2020-01-15 at 4.22.38 PM.png[/attachment]

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.

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

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?