Current filter:
                                You should refresh the page.
                                  • Hi to everyone at DevExpress,

                                    we have a window controller loading objects filtered by two dates (start / end). The filters ought to be changed by a second controller (ViewController) . As far as we understand, this could be done by transferring the new values via the ObjectsGettingEventArgs parameters into the ObjectSpace_ObjectsGetting event of our window Controller. We just can't figure out how exactly this is done.

                                    Here is small snippet of code. The parameters dTStart, dTEnd are to be changed.

                                    private void ObjectSpace_ObjectsGetting(Object sender, ObjectsGettingEventArgs e) { if (e.ObjectType == typeof(WeekViewItem)) { WeekViewList weekViewList = new WeekViewList(); bool llok = weekViewList.Loaditems(((XPObjectSpace)lobj).Session.DataLayer, dTStart, dTEnd); if (llok) e.Objects = weekViewList.Weekviewitems; }

                                    Any advice would be greatly appreciated!

                                    Best regards

                                1 Solution

                                Creation Date Importance Sort by

                                Hello Ralf,

                                There are two ways to apply this filter:

                                1. Handle the ObjectsGetting event in the same controller where these parameters are defined (ViewController). In this case, you will be able to access parameter values directly in the ObjectsGetting event handler. To force the ObjectsGetting event execution at an appropriate moment, call the View.CollectionSource.ResetCollection method. See an example in the Correct usage of a non-persistent object ticket.
                                2. Filter the ListView with these objects using the View.CollectionSource.Criteria property - see Criteria Property of a List View's Collection Source. Then, call the View.CollectionSource.ResetCollection method to force the ObjectsGetting handler call. The specified CriteriaOperator will be available in the ObjectsGettingEventArgs.Criteria parameter. Refer to similar tickets for details:
                                CollectionDataSource criteria filter does not filter non-persistent objects
                                Filtering a listview based on a non persistent object
                                How to use the Show In Report action with non-persistent objects
                                • Ralf Daenicke 09.12.2019

                                  Thanks, Anatol! That helps a lot!