XAF – Loading Empty ListView until the user does a search

Well, this was easier than I thought.

The idea here is not load any data in the ListView until the user actually does a search (using the Full Text Search action).

Not loading  data, that is easy, just pass a Criteria you know won’t apply.

Now it comes the neat part.

We want this fake filter to be overridden by the Full Text Search action when it is executed. According to this ticket we need to use the same ID as the Full Text Search action to make sure this happen. As we see in the picture above in the source code of the FilterController this ID is called “FullTextSearchCriteria” so:

((ListView)View).CollectionSource.Criteria["FullTextSearchCriteria"] = CriteriaOperator.Parse("StartsWith([Name], 'A233241dsaasfdascsa')");

Any crazy filter will do. and that is it, let’s see it working:

Source Code: https://github.com/jjcolumb/BlogDemo

Bonus: If you want to add a filter DetailView before loading the ListView take a look at this ticket. And let me give you a quick visual on this scenario:

Until next time, XAF out!


Posted in XAF

Leave a Reply

Your email address will not be published.