What can be noticed here:
- begin always returns 0, it's the index of first element in the collection
- count returns the number of objects in the collection for the current step
- current returns the reference to the current row (in the iterators loop)
- end is supposed to return index of the last element - unfortunately it returns null
- last is supposed to return true for the last element and false otherwise, it's null (see bug: varStatus.last working?)
- index returns row index, could be used to display order number value for each row as #{vs.index+1} because it starts from 0
- step is always 1 - each row from the collection should be displayed
You need to compare current row index with row count in the collection #{bindings.TheNameOfTheIterator.estimatedRowCount==vs.index+1}. The screenshots above presents filtered collection. Filtering and sorting don't corrupt the solution.
Please notice that varStatus is not only related with <af:table> but also with other components like <af:iterator> or <af:forEach> and its attribute set (and returned values) may differ there.
Another great post! Just a small note - is the blog title OK? I have such feeling there is a word missing after "in the"...
ReplyDeleteHi Nice Post.. but how can we access the selected rows varStatus value from a bean. Pls help me on this.
ReplyDeleteYou can resolve EL expression in the code. But the same as for the JSF, you must be in the "context" of table (means that i.e. there is a button in each row and the code is under the button).
ReplyDeleteCould you describe the use case?