Thursday, October 8, 2009

tomahawk datatable getrowdata

If you are using a tomahawk datatable and wanting to implement a commandlink column...the below is how you get rowdata and relevant key of the row...

1. The link in the column should like below...


                                

2. Code inside the managed bean should look as follows:

    public void mymethod(ActionEvent ae) {

    MyBean mybean = null;

    UIComponent tmpComponent = ae.getComponent();

    while (null != tmpComponent && !(tmpComponent instanceof UIData)) {
      tmpComponent = tmpComponent.getParent();
    }

    if (tmpComponent != null && (tmpComponent instanceof UIData)) {
      Object tmpRowData = ((UIData) tmpComponent).getRowData();
      if (tmpRowData instanceof MyBean) {
        mybean = (MyBean) tmpRowData;
         //now that you have your bean populated...
         //get the key id or any other value you want...
      }
    }
    //exception handling here...
  }

Let me know if you need any help...

0 comments:

Post a Comment

About This Blog

In this blog you will find simple but great ideas on various topics ranging from food recipes to investment strategies. I hope the ideas presented in this blog will help you all in some way or other. Also included are the recent and hot news around the world...

Go ahead and grasp my ideas...

Disclaimer and Terms of Use

All the ideas and opinions provided herein are intended to share and inform simple and useful information. They come with no warranty of any kind. If you should choose to interpret graspmyideas.blogspot.com information as perfect working ideas, or advice or if you want to completely rely on these ideas, you do so at your own risk.

This site is offered as is and without warranties of any kind. We are not responsible for timeliness, accuracy, unavailability or interruptions in availability, viruses or other defects in the site or its contents. In no event shall graspmyideas.blogspot.com site or its authors are responsible for any damages to users or their computer systems.


Your Ad Here

  © Blogger template AutumnFall by Ourblogtemplates.com 2008

Back to TOP