Syncing BO and Devexpress Grid when there's a broken rule
 
Home My Account Forum Try It! Buy It!
About Contact Us Site Map
StrataFrame Forum
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      



Syncing BO and Devexpress Grid when there's a...Expand / Collapse
Author
Message
Posted 05/05/2008 3:40:13 AM
StrataFrame Novice

StrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame Novice

Group: StrataFrame Users
Last Login: 07/01/2008 9:51:35 PM
Posts: 62, Visits: 515
G'day

I've got a BO being maintained in a Devexpress grid. I'm saving the bo if required in the grid's BeforeLeaveRow event, and if the save causes a broken rule stoping the move off that row. My problem is that if I have a column with a sort on it and change a value in that column that will cause a broken rule, as soon as I click onto another row the sort takes effect before the BeforeLeaveRow event, whisking the broken row out from under me (similarly if I apply a sort to a different column if I already have a broken rule in the current row).

I've tried navigating in the grid to try to get back on the broken row, I've tried setting the BO's AutoNavigateToFirstBrokenRow, I've tried navigating and moving in the BO to the Broken row, all to no avail. Anyone have any ideas where I might have gone wrong, or what should work?

Peter

Post #16123
Posted 05/05/2008 9:54:55 AM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Yesterday @ 9:47:36 PM
Posts: 4,115, Visits: 4,185
Sorts...they are always good for causing an issue   I am not familiar with the DevExpress grid off of the top of my head, but the first thing I would think to try would be to handle the SortChanged event (if one exists) on the grid.  This would at least inform you that the sort has changed.  You could then set the sort of the BO to the same value as the grid which would put the rows in the same order.

That would be the first thing that I would try.

Post #16136
Posted 05/06/2008 3:49:54 AM
StrataFrame Novice

StrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame Novice

Group: StrataFrame Users
Last Login: 07/01/2008 9:51:35 PM
Posts: 62, Visits: 515
Trent,

I thought about your advice and decided that sorting the BO the same as the grid would be too difficult given that the grid also does grouping and filtering, and it seemed too much to hope that I could get exactly the same ordering in the BO after several of these had been applied.

After a further day working on the problem I almost have a solution. Clicking on a new row in the grid fires a BeforeLeaveRow event followed by a FocusedRowChanged event. There are gridview methods that allow me to translate between rowhandles on the grid to rowindex in the BO. What I was doing in the BeforeLeaveRow was to save the BO and hence setting any broken rules, then if there was a broken rule setting e.allow in the event args to stop the row movement happening, and then if the first broken row isn't the current row attempting to change the Focused row onto it (which was not happening, and I'm assuming that it was because setting e.allow to false stopped any pending FocusedRowChanges). Anyway, moving this logic to the FocusedRowChanged event handler has allowed the focused row to be changed and I'm almost set. Still a few lose ends to tidy up and different scenarios to test.

Peter

Post #16169
Posted 05/06/2008 8:51:00 AM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Yesterday @ 9:47:36 PM
Posts: 4,115, Visits: 4,185
Thanks for the info, Peter.  I am sure others will appreciate the input as well!
Post #16175
« Prev Topic | Next Topic »


Reading This TopicExpand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: Ben Chase, Trent L. Taylor, Steve L. Taylor

PermissionsExpand / Collapse

All times are GMT -6:00, Time now is 2:16am

Powered By InstantForum.NET v4.1.4 © 2008
Execution: 0.078. 16 queries. Compression Enabled.
Site Map - Home - My Account - Forum - About Us - Contact Us - Try It - Buy It

Microsoft, Visual Studio, and the Visual Studio logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries.