Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
55
I do not understand the architectural decisions in IGridModel - can someone help?
posted

Hello-

Can someone help me to understand why the IGridModel has properties that decide how the grid is rendered?  Models aren't really supposed to know about rendering, and yet a sizeable chunk of the properties in the 'model' interface are directly concerned with rendering: there are properties such as caption, control sizes, which are concerns of either the view or the controller and are more typically set during rendering.

It appears as though, at first glance,that there isn't really a distinction between layers and as such it's an awkward fit in the MVC pattern, which sort of forces a layered approach. It also appears to break one of the nicest parts of MS MVC, which is that the web programmers can focus on webby behaviors and the model developers can focus on domain behavior.

Am I simply misunderstanding what I'm seeing?

Parents
No Data
Reply
  • 24671
    Suggested Answer
    posted

    That's not a Model in the sense of an MVC Model. It just describes/models all properties that the component can be configured with. It's not describing your application model. We provide ways to configure the controls both in your controller, as well as the view , via chaining, as it can be seen on this sample, for example:

    http://samples.infragistics.com/jquery/grid/remote-sorting

    Provided that MVC does not support any state saving and state management by default, sometimes it is inevitable to configure a component in the controller. that's the case with Load on demand in the hierarchical grid, when other features are also enabled, and you have a mix of local vs. remote operations. 

    There are several advantages of using the GridModel, as opposed to configuring your grid directly in the View (which is the most common scenario, no arguing in that):

    (that's taken from the MVC contrib grid practices) :

    • If you have large grid definitions using a GridModel can help to keep the view uncluttered.
    • It is easy to re-use the same grid in multiple locations.
    • You can re-use common grid code through inheritance.

    Hope it helps,

    Angel

     

     

Children