PDA

View Full Version : MonoRail ExtJS Helper



rstuven
11 Apr 2008, 7:00 AM
Check out http://code.google.com/p/mr-extjs-helper

mdissel
12 Apr 2008, 11:56 AM
Nice! Some feedback..
Currently you're generating the Ext forms with every requests.. I like the part of generating it server-side (using compile-time checks / intellisense, but that's not available with brail :( )
Ideally you want to create an Ext module (form or whatever) that's loaded a single time by an ajax request in the main page, the next time it will only load the dynamic part
For example: the contact edit form, first time load the form definition and data, second (etc.) time only load the data part (at least that's what i have i mind). The module component that's inside the extbasex.js module (http://extjs.com/forum/showthread.php?t=21681) could be useful for this..

mdissel
12 Apr 2008, 12:53 PM
Small optimization: the store property of a ComboBox accepts an array (one or two dimensional) (in Ext 2.0.2 or higher), the SimpleStore declaration is not necessary anymore.

rstuven
12 Apr 2008, 6:43 PM
Thanks for your feedback. Some comments:
- I will try your optimization tip.
- You could get intellisense and compile-time checking using AspView (http://using.castleproject.org/display/Contrib/Castle.MonoRail.Views.AspView). I have not tried it in combination with my helper, but I think it should have no issues but the lack of literal dictionary syntax in C# which can be supplied by anonymous types and ReflectionBasedDictionaryAdapter (http://svn.castleproject.org:8080/svn/castle/trunk/Core/Castle.Core/ReflectionBasedDictionaryAdapter.cs).
- Yes, you don't need to recreate the form and can rely on other methods to load the form after created, such as Ext.form.Action.Load (http://extjs.com/deploy/dev/docs/?class=Ext.form.Action.Load).
- The demo just shows one possible way to work with the helper. For instance, the form loading mentioned before and the use of Ext.ux.MonoRail.Container which is optional.
- More importantly, this helper is not intended to be used in every situation. Pure Javascript is just fine in most of the cases. But if you want to enforce validation in the client and in the server based on the same validation rules definition, this helper is a good choice.

ehauser
7 May 2008, 7:42 PM
Hi,

I'm looking at your implementation as a basis for integration between ExtJS and MonoRail.

I realize that you are using the FormObject as a wrapper so that you can translate the response into JSON that the ExtJS forms will understand. Could you just decorate the method with a [FormResult] attribute and do the tranlation of the PropertyBag in the InvokeMethod override of ExtJSController? I like that approach because then your Controller does not need to have any knowledge that it returning an ExtJS form response.

Just trying to understand the implementation better. Good stuff.