CurrentRowIndex


Author
Message
Edhy Rijo
E
StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Chan (01/04/2009)
May I know what is the "workaround"?

Hi Chan,

I guess it is to reset the filter prior adding then set the filter again, here is a pseudo code:

DIM strTempFilter as String = MyBO.Filter

MyBO.Filter = String.Empty

MyBO.Add()

MyBO.Filter = strTempFilter



Edhy Rijo

Chan
Chan
Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 reputation)
Group: Forum Members
Posts: 533, Visits: 2K
Hi,

May I know what is the "workaround"?



Thank you
Larry Caylor
Larry Caylor
StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)
Group: Awaiting Activation
Posts: 592, Visits: 3.7K
Thanks for the explanation. It must have been right after lunch when we went over that in classDoze Conceptually I can see how you could handle a sorted BO since a Sort would never remove a row from the CurrentView, but a Filter would present some issues.

-Larry

StrataFrame Team
S
StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
No, we actually try to handle the situations where a new row might be filtered out or sorted, however, the following code is called right before the SetDefaultValues() is raised, so it will be right up until you set a field within the SetDefaultValues().  The problem with having a sort or filter set when you're adding rows is that the record might change each time you set another column on the business object, causing the view to resort or refilter the row.

                '-- Start from the back of the list and cycle through the rows to find the row index
                For lnCnt = Me.Count - 1 To 0 Step -1
                    If _CurrentDataTable.DefaultView(lnCnt).Row Is loRow Then
                        '-- We've found our row index
                        lnRowIndex = lnCnt
                        Exit For
                    End If
                Next

                '-- Set the row index to the index of the new row
                _CurrentRowIndex = lnRowIndex


Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Yup....if you recall, we actually touched on this briefly during class because I too have been there before.  When you add the new record the filter is immediately applied.
Larry Caylor
Larry Caylor
StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)
Group: Awaiting Activation
Posts: 592, Visits: 3.7K
After a little more testing I found my original tests were incorrect and that a Filter causes the same behavior as a SortBlush  I'm assuming that this is probably by design and you can't add rows to sorted or filtered BOs.

-Larry

Larry Caylor
Larry Caylor
StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)
Group: Awaiting Activation
Posts: 592, Visits: 3.7K
When I use the Add() method to add a new row to a BO that has a Sort defined, the CurrentRowIndex is being set to zero rather than the actual index of the new row. If a Filter is added to the BO rather than a sort, the CurrentRowIndex is maintained correctly.

I'm on v1.61 pre-release.

-Larry

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search