Hi everyone. I'm working on a library that should make my colleagues' life easier when working with JavaScript at work. For that, I'm trying to create an API that pushes the HTML markup from the server (using
HTML Helpers), and provides the basic functionality using pre-baked KnockoutJS view models that they could extend.
So far I've got the whole thing working fine. The following line outputs the required HTML to display a paged list of items (metro-ish tiles).
@Html.HorizontalView("/Employee/Get","tile-default", "employees", 30)
But what if the user of the HTML helper also wants to group the items instead? What if they want both? I could create several overloads of the Html.HorizontalView() extension method which should work fine. But on the client side, how do I detect the capabilities required by the user and accordingly provide the appropriate view model that supports that?
I was looking into maybe implementing the decorator pattern where I have a base view model, and them some decorators of the view model. What do you think?
Any ideas/alternatives?