Re: T5 setting initial sort order for grid in T5.0.11

2008-07-31 Thread grashopper



Tobias Wehrum wrote:
 
 But that doesn't seem very ideal to me, and I hope there is a better way.
 

I'd still prefer to be able to specify a default sorting in the template,
but here's how I implement an initial sorting on a grid:

if ( grid.getSortModel().getSortContraints().isEmpty() ) {
  _grid.getSortModel().updateSort(colName);
}
-- 
View this message in context: 
http://www.nabble.com/T5-setting-initial-sort-order-for-grid-in-T5.0.11-tp17165163p18758484.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: T5: ActionLink/Zone components inside a loop (solved, better)

2008-06-25 Thread grashopper


Corin Lawson wrote:
 
 But it gave me another idea to free my code from getCurrentZoneId method.
 I am now significantly satisfied with the following solution. It makes for
 one very lean POJO.
 

But in cases like mine, where the zone comes after the links in the markup
(which should be a quite common case) - the problem sadly remains, since the
name of the zone can't be determined before rendering it :-(
-- 
View this message in context: 
http://www.nabble.com/T5%3A-ActionLink-Zone-components-inside-a-loop-tp15374193p18115824.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



T5: Dynamically extending volatile list

2008-06-05 Thread grashopper

Hi,

I'd like to implement a form to edit elements of a collection. The contained
list is fetched onActivate of the submit request as well, so the loop is
marked as volatile.

The critical part, I'm not able to get to work, is where I add a new Element
(virtually on client side) to the list.
I do not want to add the colletion to the session because this is imho not
where it belongs. It is much more to be passed from request to request. Just
for the redirect after the post it should be passed through the flash scope.

The adding of the new element is triggered by a  button in the form (which
has to be submitted fully as well to not loose any info that has been
entered in paralllel). After the next  Submit the collection is refeched
from db (because volatile) and tapestry tries to update the collection with
the content of the request, but since the collection in the request contains
more elements than the one that got loaded, it throws a
NoSuchElementException. 

How do I fix this without throwing the collection into the session ?


The template:
!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd;
t:layout
t:id=layout
title=Lorem ipsum
introHeading=Lorem ipsum
introText=Lorem ipsum
activePage=cms
xmlns:t=http://tapestry.apache.org/schema/tapestry_5_0_0.xsd;

t:form t:id=update t:clientValidation=false
ul
  li t:type=loop t:source=collection t:value=iter
t:volatile=true
  h3Element:/h3
  label for=positioninput:/label
  t:textfield t:id=position size=20 value=iter.position/
  /li
/ul

  t:submit t:id=addElement t:value=add element /
  t:submit t:id=save t:value=save /
/t:form

/t:layout   
--
The page class:
public class CollectionTest {
@Inject
private Facade _facade;

@Inject
private ComponentResources _resources;

@Persist(flash)
private ListElement _collection;

private Element iter;

public void onActivate() {
if ( _collection == null ) {
collection = _facade.getCollection(..);
}
}

public void cleanupRender() {
_resources.discardPersistentFieldChanges();
}

public void onSelectedFromAddElement() {
_collection.add(new Element());
}

public void onSelectedFromSave() {
//_facade.store(_collection, ..);
}

public ListElement getCollection() {
return _collection;
}

public void setCollection(ListElement collection) {
_collection = collection;
}

public Element getIter() {
return iter;
}

public void setIter(Element iter) {
this.iter = iter;
}
}
-- 
View this message in context: 
http://www.nabble.com/T5%3A-Dynamically-extending-volatile-list-tp17666544p17666544.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]