Skip to content

Lookupeditor criteria #9

@demonicmetalcs

Description

@demonicmetalcs

If you have a lookup editor and it is connected to a view that has criteria and the mode is not search. The criteria is not applied.

So in the class XafBootstrapLookupPropertyEditor I have replaced the following code
in my test this works fine I have NOT added this to the code on Github, that is something for you to do.

Old Code :
if (!IsSelector)
{
cs = Helper.CreateCollectionSource(Helper.ObjectSpace.GetObject(CurrentObject));
if (Helper.EditorMode == LookupEditorMode.Auto || Helper.EditorMode == LookupEditorMode.AllItemsWithSearch)
IsSelector = cs != null && cs.List.Count > 20;
}

New code:

if (!IsSelector)
{
cs = Helper.CreateCollectionSource(Helper.ObjectSpace.GetObject(CurrentObject));
if (cs != null && Model.View is IModelListView && !string.IsNullOrEmpty(((IModelListView)Model.View).Criteria))
cs.Criteria.Add("ViewCriteria",CriteriaOperator.Parse(((IModelListView)Model.View).Criteria));
if (Helper.EditorMode == LookupEditorMode.Auto || Helper.EditorMode == LookupEditorMode.AllItemsWithSearch)
IsSelector = cs != null && cs.List != null && cs.List.Count > 20 ;
}

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions