Showing results for 
Search instead for 
Do you mean 
Reply
Solved! Go to solution

Keeping Parts Sorted in a Connection

I have a situation where I have a grid control displaying parts in a connection that is used for ordering the parts in the connection, among other things. The parts are gathered and sorted by a SortOrder property on the parts. On UI initialization, the grid displays the correct parts, and they sort correctly.

Dim colParts As New RsCollection
For Each oLoad As Object In Me.ToMyAssignedUILoads.Parts
	If oLoad.AssignedSuctionGroupID = CInt(Me.CIR_ShowLoads) Then
		colParts.Add(oLoad)
	End If
Next 'oLoad
colParts = SortObjectsByProperty(colParts, "SortOrder", False)
Result = colParts

Once I execute my MoveUp/MoveDown code, I need the grid control to re-sort based on sort order.

  • I've tried refreshing views at various times, but that's not re-sorting the grid/connection. 
  • I've tried to find a sort method on the connection that I can call after MoveUp/MoveDown, but I'm not finding one

Any other ideas?

 

I'm using 12.0.0

2 REPLIES

Re: Keeping Parts Sorted in a Connection

Hi,

 

I've experienced issues related with grids linked to a connection in the past as well and it seems a RS bug.

If grid is connected to a connection it not always refreshes properly.

 

Workaround we applied wasto use subpart instead of connection (it can be a subpart that gets data from connection itself).

So you can have a subbpart that will have quantity defined as Me.(...).MyConnection.Quantity and for each pf instance in subpart properties might have formulas as Me.(...)MyConnection(Me.SubpartId).MyProperty.

 

This should help even if it's not a solution of a problem but workaround

Solution
Solution
Accepted by topic author EIChrisP
a month ago

Re: Keeping Parts Sorted in a Connection

Thanks for the reply.

 

In my situation, I have a control that changes the connection used by the grid (different filters of the same subpart collection).

 

My workaround was to change the the connection, refresh views, then change it back and refresh it again, which updates correctly. It causes some flashing, but it's not terrible.

 

The other issue was that even after the final refresh, the selected row index property does not update correctly, so I had to walk the displayed parts and reset the selected row index. 

 

The combination of these two workarounds has resolved the issue for me.