Hi,
Why do we need a model class to bind data to grid?.
if we see the sample examples of igGrid, there is no model class to bind data. in our project, we are using model class. cant we display data (bind data to grid) without model class.
Thanks,
Shwetha
Hello Shwetha,
Thank you for posting in our forum.
In case you are using an MVC architecture, it is recommended to separate your View and presentation from the underlying business logic.
If you remove the Model, you will have to write all your database queries and persist the data yourself – the result will be bloating your codebase, making it harder to maintain, test and debug.
Also you will have to place all the code related to your application’s business logic or data persistence inside your Controller – this is the so called “fat controller” approach. It usually works only if your application is very small. Once it scales – the code gets unreadable, complex and hard to work with.
In case your data is not too large and the business logic is not too complex – you may place the code from the Model inside your Controller or View.
You might find this discussion interesting:
https://stackoverflow.com/questions/5093880/what-is-the-usage-of-model-in-mvc-is-it-actually-useful
If you need any additional assistance, feel free to contact me.
Best Regards,
Vasil Pavlov
Associate Software Developer
Infragistics, Inc.