Brummeline Braaten schrieb:
> Werner Punz <werner.punz <at> gmail.com> writes:
> 
>> commandlink value="All" action="tabnavigering.doloadentirelist" ...
>>
>> then you can trigger a list reload from your backend action, you however
>> have to savestate something so the state is kept. (either reload the
>> list every time you do something in your form, or keep the state somewhere)
>>
>>
> It sounds so difficult! I don't understand how to do this. I can send an 
> action
> with a binding to my bean. And I can navigate from the bean through the
> navigationrules I've made in faces-config. But how can I tell the page to 
> reload
> without the rows="7" attribute?
> 
Actually this is a basic jsf mechanism,
you do not need a navigation rule for this,

just use an action, once the action is triggered reload your entire list
and you are set.
It is more or less how you would make it in a rich client user interface
action->do something done...

The navigation rules are just there to allow a configuration based
navigation from one form to the other, as long as you stay in the same
form, just declare the action in your backing bean, and you are set.

This is one of the powers of jsf, that the programming model is very
close to a rich client user interface. Hoever if you come from a Struts
background, you have to unlearn some patterns struts does differently.


Too keep the i want to show the entire list setting you have to make
some web centric compromises.
The best bet in your case probably would be to keep the setting
of your list load in a hidden field, this is the closest you have to
normal html (there are other ways, like savestating the database model
or using savestate, either that or read up the savestate documentation
in the myfaces wiki)



So what you basically do is following
<h:inputHidden value="#{backendform.entirelistloaded}" />

or
<t:saveState value="#{backendform.entirelistloaded}" />


<h:commandLink action="#{backendform.doloadmyentirelist}" />

on the javaside:

List thedatalist = null;
boolean entirelistloaded = false;

private loadList() {
...
}

public String doloadmyentirelist() {
        loadList();
        entirelistloaded = true;
        return "done";
}



also for subsequent refreshes you might call loadList at a stage where
you need it (getter for instance or if you use shale, the init method)


like
public List getThedatalist() {
        if(thedatalist == null)
                loadList();
        return thedatalist;
}


An alternative way would be to use the shale View controller for this
initialisation or use the model savestating of the tomahawk data tables
or even the entire list via t:sae.

There are numerous ways to achieve what you want.

Reply via email to