My favorites | Sign in
Project Logo
          
Code license: Apache License 2.0
Labels: monorail, extjs
People details
Project owners:
  rstuven

Provides utility classes to work with ExtJS library from Castle MonoRail MVC web framework.

As FormHelper does, ExtJSHelper mainly takes care of data binding and validation at the browser side based on server side declarations. But also there are methods that provide foundation for advanced applications (see Container method and Ext.ux.MonoRail.Container.js script).

Let's start from an ExtJS-only sample code that is not enjoying MonoRail databinding and validation:

	var f = new Ext.FormPanel({
		id:"contact-form",
		url: '/Contact/Save.castle',
		items:[
			new Ext.form.TextField({
				name: "contact.FullName",
				fieldLabel: "Full Name"
			})
		]
	});

Adding ExtJSHelper the code looks like this (using Brail view engine):

	${ExtJSHelper.BeginForm({@id:"contact-form"})}

	var f = new Ext.FormPanel({
		id:"contact-form",
		url: '${Url.For({@action: "Save"})}',
		items:[
			${ExtJSHelper.TextField("contact.FullName", {
				@fieldLabel: "Full Name"
			})}
		]
	});

	${ExtJSHelper.EndForm()}

Even we can make it fully configured by ExtJSHelper (note how Brail hash notation is everywhere):

	${ExtJSHelper.BeginForm({@id:"contact-form"})}

	${ExtJSHelper.FormPanel({
		@assignTo: "contactForm",
		@url: Url.For({@action: "Save"}),
		@items:[
			ExtJSHelper.TextField("contact.FullName", {
				@fieldLabel: "Full Name"
			})}
		]
	})}

	${ExtJSHelper.EndForm()}

Also you can configure some fields after they are rendered. For example:

	var f = new Ext.FormPanel({
		id:"contact-form",
		url: '${Url.For({@action: "Save"})}',
		items:[
			new Ext.form.TextField({
				name: "contact.FullName",
				fieldLabel: "Full Name"
			})
		]
	});
	f.render("container");

	// Some code here...

	${ExtJSHelper.BeginForm({@id:"contact-form"})}
	${ExtJSHelper.ApplyToField("contact.FullName")}
	${ExtJSHelper.EndForm()}

See the demo app for more examples and the XML documentation in ExtJSHelper class.


Issues to work on:

Notes on the demo:









Hosted by Google Code