-
1. Re: Table Control
ilya_shaikovsky Jul 23, 2008 9:31 AM (in response to kash_meu)dataFilterSlide is a component which filters data by some field.
But if you need only limit number of rows to be displayed there's no need in such control. You just need something like:<h:inputText value="#{someBean.someInt}"/> rich:dataTable rows="#{someBean.someInt}"> ...
B.t.w. Link to demo sources in our wiki. -
2. Re: Table Control
kash_meu Jul 23, 2008 10:21 AM (in response to kash_meu)I have to use AJAX. So the page does not need to refresh.
I have tried a piece of code but It is not working. This works when I re-render an outputText, but not with other components. I think this works only for span tags.<h:inputText value="#{subscriptionService.numberOfTokens}"> <a4j:support event="onkeyup" reRender="out" /> </h:inputText> <a4j:outputPanel id="out"> <h:inputText value="#{subscriptionService.numberOfTokens}" /> </a4j:outputPanel>
-
3. Re: Table Control
ilya_shaikovsky Jul 23, 2008 10:22 AM (in response to kash_meu)this also described in our FAQ. wrap first input with a4j:region ;)
-
-
5. Re: Table Control
kash_meu Jul 24, 2008 1:02 AM (in response to kash_meu)I am one more little problem.
I have an arraylist associated with the datatable. The number of rows are dependent on the number of items in this array list. When I edit the input text box, the setter of the related property is called. What I have is done, is that in the setter I initialize the array list with that number of elements.
Now, this setter is called twice. First when I change the value in the text box, it is called through AJAX, and secondly, when the form is submitted.
As a result, when the form is submitted, the setter of the text field re-instantiates the array list.
Is there anyway that the arraylist instantiation code be placed in some other function other than the setter of the text field? I want to instantiate the array list only when the value is changed, but not when the setter is called -
6. Re: Table Control
kash_meu Jul 24, 2008 2:04 AM (in response to kash_meu)I have refined my work to some extent. I need the answer to a simple question. How can I get the value in the following function.
public void updateArrayList(ActionEvent e)
{
//value of the bean.numberOfRows needed here
}
In jsf, this is my code.
<a4j:region>
<h:inputText style="width: 39px" id="numberOfRows"
value="#{bean.numberOfRows}">
<a4j:support event="onkeyup" reRender="out" actionListener="#{bean.updateArrayList}" />
</h:inputText>
</a4j:region> -
7. Re: Table Control
mail.micke Jul 24, 2008 3:24 AM (in response to kash_meu)The updateArrayList( ActionEvent ) is in the bean class right? If so isn't the numberOfRows property already set?
-
8. Re: Table Control
kash_meu Jul 24, 2008 3:29 AM (in response to kash_meu)Now I am able to access that. Thanks.
Now, my datatable is not mapping with the array list.<h:dataTable value="#{bean.arrayList}" var="item"> <inputText value="item.prop1" /> . . . </h:dataTable>
The array list is not populating -
9. Re: Table Control
mail.micke Jul 24, 2008 5:46 AM (in response to kash_meu)So you have
public List getArrayList(){ return theArrayList; }
in your bean class? If not you should add it.
the datatable code you've posted is not correct, it should be something like:<h:dataTable value="#{bean.arrayList}" var="item"> <h:column> <h:inputText value="#{item.prop1}"/> </h:column> </h:dataTable>
-
10. Re: Table Control
kash_meu Jul 24, 2008 5:50 AM (in response to kash_meu)Yes! I have the getArrayList(); method
and sorry for the mistake. Thanks for the correction