Cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted

Keeping Parts Sorted in a Connection

Solution Partner Valued Contributor Solution Partner Valued Contributor
Solution Partner Valued Contributor

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

4 REPLIES 4

Re: Keeping Parts Sorted in a Connection

Valued Contributor
Valued Contributor

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

Adam Liszkiewicz
Configuratori Polska

Re: Keeping Parts Sorted in a Connection

Solution Partner Valued Contributor Solution Partner Valued Contributor
Solution Partner Valued Contributor

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.

Re: Keeping Parts Sorted in a Connection

Experimenter
Experimenter

Hi ChrisP,

 

I am facing a Similar Scenario. We are displaying the Parts of SubpartCollection onto the Grid. But we need to display parts (newly added part as a first Row in the Grid) in this order. Hence we created a connection that has the parts in the order we need. But wen we show the connection parts on the Grid, the grid is still display parts in old order(i.e the way the parts are arranged in SubPartCollection).  How to acheive the softing of the Parts on the RsGrid.

Re: Keeping Parts Sorted in a Connection

Valued Contributor
Valued Contributor

Hmm.. If you just need to add part in specific place in Subpart then I think it might be possible.

Subpart object contains rsCollection Parts that actually stores parts.

rsCollection implementation of Add is as follows:

Add(object Item, string Key = null, object Before = null, object After = null)

 

so theoretically it should be possible to Add new part before existing one (so first in your case) or after existing part.

 

Adam Liszkiewicz
Configuratori Polska