Grid programmatic row reordering  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

Grid programmatic row reordering

Postby neil.interactit » Thu May 11, 2023 10:21 am

Hi Mike,

I have made good use of your Sample Plugin Editable List Maintenance as a ShowDialog(), thanks!

The client has come back with a specific requirement to be able to re-order a group of rows.

Something like grdLines.AllowMultipleRowSelect = true, and then letting the underlying FarPoint grid do the heavy lifting would be an easy option, but I couldn't spot or locate this functionality?

Alternatively, I have access to everything else I need (grdLines.RowDragMoveCompleted, etc) to be able to programmatically "override" the single row move and move the remaining rows in the group if I could access something like grdLines.RowMove(fromIndex, toIndex, count).

Could you advise if I'm barking up the wrong tree, of if there is an approach available?

Cheers,
Neil.
neil.interactit
Kohai
Kohai
 
Posts: 227
Joined: Wed Dec 03, 2014 2:36 pm
Topics Solved: 6

Re: Grid programmatic row reordering  Topic is solved

Postby Mike.Sheen » Thu May 11, 2023 10:53 am

neil.interactit wrote:The client has come back with a specific requirement to be able to re-order a group of rows.

Something like grdLines.AllowMultipleRowSelect = true, and then letting the underlying FarPoint grid do the heavy lifting would be an easy option, but I couldn't spot or locate this functionality?


I believe the AllowMultipleRowSelect property would only be useful for allowing the user to select multiple rows, no necessary if you want to move them using code.

neil.interactit wrote:Alternatively, I have access to everything else I need (grdLines.RowDragMoveCompleted, etc) to be able to programmatically "override" the single row move and move the remaining rows in the group if I could access something like grdLines.RowMove(fromIndex, toIndex, count).

Could you advise if I'm barking up the wrong tree, of if there is an approach available?


Now I'm confused - the drag events occur after the user has moved rows on the grid with the mouse - if you're wanting to programmatically move rows, then those events are of no use to you - use the MoveRow method to use your code to move rows - e.g.: to move row 0 to row 5:
Code: Select all
grdLines.ActiveSheet[0].MoveRow(0, 5, true);


You could also use a custom sort if that's more appropriate - depends on what you're trying do - but MoveRow will certainly move rows.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756

Re: Grid programmatic row reordering

Postby neil.interactit » Thu May 11, 2023 2:00 pm

Probably more accurately - I was confusing!

THat was the method I couldn't spot - thanks - I can make that work.

The basic plan is to allow the user to drag a single row, capture RowDragMoveCompleted, prevent recursion, then .MoveRow() the other rows in the group.

So, given rows A1,A2,B1,B2,C1,C2,C3,D1,D2 if C1 is dragged to B1 then .MoveRow() can also move C2,C3 then finally allow the ItemNo renumbering to fire.

I'll give it a go.

Cheers,
Neil
neil.interactit
Kohai
Kohai
 
Posts: 227
Joined: Wed Dec 03, 2014 2:36 pm
Topics Solved: 6


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 17 guests