Re: How to use WODisplayGroup
Re: How to use WODisplayGroup
- Subject: Re: How to use WODisplayGroup
- From: Francesco Romano <email@hidden>
- Date: Sun, 7 Dec 2008 14:54:19 +0100
On 06/dic/08, at 20:30, Ramsey Lee Gurley wrote: On Dec 6, 2008, at 9:11 AM, Francesco Romano wrote: That could be an idea...
But... in this way a displayGroup is very similar to a simple array.. What are the advantages?
Display groups have batching, qualifiers, auxiliary qualifiers, sort orderings, and datasources. The display group does all the heavy lifting for your view code. If you were to just use arrays, you'd end up reinventing most of the display group. Combine display groups with a batch navigation bar for more awesomeness :-) By the way... a very simple request...
I want to bind a record attribute with a textfield.
I can do for a "read-only" page.
But is there a way to have a bidirectional bound?
I mean...this is the html
<wo:WORepetition list="$ipnDisplayGroup.displayedObjects" item="$luogo">
<p><wo:textfield value = "$luogo.nome"></wo:textfield></p>
</wo:WORepetition>
</wo:if>
If I edit the text in the textfield how can this modify the item in the displayGroup (so that the only thing to do is to call saveChanges() on the editing context..
Yep. That's pretty much what it does. ORM... isn't it great? :-) Of course, if you want to modify the object, you'll need to drop that text field in a form element at the very least. I really like w3schools page of html elements by function. http://www.w3schools.com/TAGS/ref_byfunc.aspSince a wo:form maps to the form element, your html should probably look something like: <wo:form> <fieldset> <legend>Hi I'm an informative legend!</legend> <wo:loop> <!-- wo:loop is a shortcut for WORepetition --> <label for="">I'm a textfield label!</label><wo:textfield id="id1"/> <!-- or --> <label>I'm a label too<wo:textfield/></label> </wo:loop> <wo:submit action=""> </fieldset> </wo:form>
I can't modify it..
This is the code: (inside a form)
<wo:form> <fieldset> <wo:if condition = "$isTableLuogo">
<wo:loop list = "$ipnDisplayGroup.displayedObjects" item = "$aLuogo"> <p><wo:textfield value = "$aLuogo.nome"></wo:textfield></p> </wo:loop>
</wo:if> <p><wo:link action="$addItem"> aggiungiElemento</wo:link></p> <p> <wo:link action = "$applyChanges">Applica</wo:link> <wo:link action = "$cancelChanges">Annulla</wo:link> <wo:link action = "$saveChanges">Salva</wo:link></p> </fieldset> </wo:form>
If I try to edit the field, and press "Apply" the record is not updated... What is wrong?
(This is the code for applyChanges) public WOActionResults applyChanges() { session().defaultEditingContext().saveChanges(); return null; }
For other shortcuts... or to create your own, check your eclipse preferences:
<Picture 1.png>
And, one last shortcut that might not be obvious is command clicking. When you define action="" and you get that red underline telling you it isn't defined in your java file, just command-click it and it will act like a hyperlink that creates the method and takes you to it in your java file. Command clicks work in your java source too.
Ramsey
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden