Ticket T1282161
Visible to All Users

Bad data in datasource property

created 2 days ago

Hello support,
I have a non-persistent view, where I have a datasource property and I filter it according to something. And if there is less in that selection than in the previous one, I get empty rows.
Thank you, for your help.
bug_blazor_combo.gif

Answers approved by DevExpress Support

created a day ago

Hello Lukáš,

Thank you for the sample project.

To show persistent objects in a non-Persistent object's view, you need to handle the OnObjectSpaceCreated event as demonstrated in the following thread: How to: Show Persistent Objects in a Non-Persistent Object's View.

C#
using DevExpress.ExpressApp; //... builder.ObjectSpaceProviders.Events.OnObjectSpaceCreated = context => { CompositeObjectSpace compositeObjectSpace = context.ObjectSpace as CompositeObjectSpace; if (compositeObjectSpace != null) { if (!(compositeObjectSpace.Owner is CompositeObjectSpace)) { var objectSpaceProviderService = context.ServiceProvider.GetRequiredService<IObjectSpaceProviderService>(); var objectSpaceCustomizerService = context.ServiceProvider.GetRequiredService<IObjectSpaceCustomizerService>(); compositeObjectSpace.PopulateAdditionalObjectSpaces(objectSpaceProviderService, objectSpaceCustomizerService); } } }

To populate the lookup property editor, I recommend you use ObjectSpace to get persistent objects that will be used to populate the editor:

C#
public IList<TestObject> TestObjs { get { if (testObjs == null) { if (Type == TestType.Type1) testObjs = ObjectSpace.GetObjects<TestObject>().Where(x => x.Test.StartsWith("1")).ToList(); if (Type == TestType.Type2) testObjs = ObjectSpace.GetObjects<TestObject>().Where(x => x.Test.StartsWith("2")).ToList(); } return testObjs; } }

See the following help topic for more information: How to: Implement Cascading Filtering for Lookup List Views > Scenario 4 - Populate the Lookup Property Manually.

I attached a modified project. Please let me know if it helps.

Regards,
Fhillip

    Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

    Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.