Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8667

Re: empty/"all" entry in DropdownBox with OData model - cleanest solution

$
0
0

Hi Ben,

 

Good thinking.

 

I guess this kind of comes down to how to interpret the MVC pattern. Let's take this specific case:

 

  • The Model represents a collection of things that are used for filtering.
  • The SAPUI5 "Control"  (the UI element which combines View and Controller as far as I can tell), namely the DropdownBox, is then responsible for rendering that collection, and registering user interactions on it.

 

Now, the philosophical question is if the "all" option is a part of the collection or not. In my eyes, that would make the Model responsible for it. Since the collection is specifically earmarked as being for filtering, and "all" is a valid filter option, I'd say it is. I think it becomes a little clearer if you substitute "all" for "empty" and just tell the Model to allow an empty selection.

 

On the other hand, if the "all" option is not considered part of the collection, as one could definitely argue, the Model has nothing to do with it. Without the context "this collection is for filtering", an "all" or empty item should not be part of the Model. In that case, the DropdownBox is responsible for adding it whenever necessary.

 

I guess you can make a case for both variants, and adding functionality to the DropdownBox control is probably easier than adding it to the ODataModel ...

 

Cheers

Christoph


Viewing all articles
Browse latest Browse all 8667

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>