• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Row Index in RichFaces Data Table

 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have been really struggling to get the row index from the richFaces Data Table in my java script function.

I tried the this object, rowKeyVar attribute, dataTable.rowIndex but nothing seems to work. I binded the data table to an htmldatatable, but still returns 1 only.

I am attaching the code for the binding attribute:

<h:dataTable binding="#{myBean.dataTable}">
<h:column>
<f:facet name="header">
<h:outputText value="Row #" />
</f:facet>
<h:outputText value="#{myBean.dataTable.rowIndex + 1}" />
</h:column>

...
</h:dataTable>

Any help or any direction will be highly appreciated.

Thanks
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try like this.

Create ListDataModel from list that you are displaying in rich:datatable.
new ListDataModel(java.util.List list);
To your rich:datatable values attribute set this listdatamodel.

Now try row.rowIndex.Should work for sure. Let me know if it does not.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"sujit sun certified", please check your private messages for an important administrative matter.
 
Soumya Saha
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I got it to work with rowKeyVar. I can pass that value in my JavaScript Function and it returns me the correct row value.

Thanks everybody and long live RichFaces

Thanks
Soumya
 
Don't count your weasels before they've popped. And now for a mulberry bush related tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic