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.
Bad data in datasource property
Answers approved by DevExpress Support
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