1

In searching I found that we can do something with rowStateVar or rowIndex attributes of <ace:datatable>, but how?

I tried using <h:outputText value="#{myDataTableVar.rowIndex}"> but it shows an error message that myDataTableVar has no property rowIndex.

1
  • If you don't want to know about icefaces datatable, then review your question.
    – RinaldoDev
    Sep 18, 2012 at 11:37

3 Answers 3

3

For a component library independent way, just use UIData#getRowIndex() as every component library specific datatable extends from this base component.

In the below example, x: can be anything: standard JSF h:, ICEfaces ice: or ace:, PrimeFaces p:, RichFaces rich:, etc.

<x:dataTable binding="#{table}" ...>
    <x:column>#{table.rowIndex}</x:column>
</x:dataTable>

Note: the binding="#{table}" is as-is! You don't need to bind it to some managed bean property.

1
  • I'm unable to see how and why "using ajax" would form a problem in this. Either you're misunderstanding the real problem, or there's more at matter in your code.
    – BalusC
    Sep 19, 2012 at 12:45
2

I found the solution <ace:datatable id='tbl' rowIndexVar="row"> and then just print like that <h:outputtext value="#{row}">
Very simple

1
1

First, set varStatus:

<ice:dataTable varStatus="status">

An then, inside that dataTable, use:

#{status.index}
3
  • Always read question carefully and completly and then answer.I have mentioned that that I want to know usage of "rowStateVar" as I am using aceface's datatable.Your answer is right but for icefaces datatable, because we havn't any "varStatus" attribute in ace:datatable ...
    – William
    Sep 18, 2012 at 4:01
  • 1
    @William There is no way on earth that your question is not about icefaces datatable. You clearly stated that when you said "while iterating datatable of icefaces", and tagget the question with icefaces and icefaces-3. Right now ace can only be considered a typo. If you don't want to know about icefaces datatable, then review your question, because it can not be interpreted in any other way.
    – RinaldoDev
    Sep 18, 2012 at 10:39
  • there is no tag for ace.Anyway i found the solution
    – William
    Sep 18, 2012 at 10:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.