Thursday, January 14, 2010

jqGrid + MVC: new version sources

Finally as promised I've put the separate pieces of the jqGrid + ASP.NET MVC solution... together in a solution - so that this time it does compile. Can't say it's usable right away because I didn't provide any runnable examples yet - but everything is there.

So here're the sources, and what's inside?

1. All the related files, including extension methods, attributes, and JS functions.
2. Required libraries (SharpArch, NHibernate, AutoMapper, MS ones - a minimal set).
3. A sample domain model, view model, controller, and view in UsersController.cs / Index.spark files - just a non-functional demo (because it relies on other controllers and parts of the real app). But it should give the idea on how easy it is to create a sophisticated grid with only few lines of code.

A lot of new stuff is implemented - for example, UIHint("" now accepts empty hint, allowing to override attributes of the automatic checkbox/select controls. But what is important is that many bugs are fixed, interfaces are even more simplified, and ServiceLocator is no longer used - repositories are passed via IoC.

Technically, with the above sources, to add CRUD page for the existing domain class, all one has to do is:
- create ViewModel and add attributes to control display/edit jqGrid behaviour
- create controller and override InternalGet/Construct/Save methods (all one-liners).

That's it. I hope to create a simple working demo for this soon.

P.S. For those who like pictures, here's an example of an edit form of the grid that was built in less than 10 minutes - and it covers maybe 20% of the functionality (no grid display with custom formatters, no validation handling, no checkboxes or datepicker, etc).

No comments:

Post a Comment