How to get the row number of a flex table

1,015 views
Skip to first unread message

Vik

unread,
Jul 4, 2010, 11:23:38 PM7/4/10
to google-we...@googlegroups.com
Hie

I have a table extending a FlexTable.

In every row there is Button. On clicking this button I want to know the row number of the table. Any idea on how to achieve this?

Thankx and Regards

Vik
Founder
www.sakshum.com
www.sakshum.blogspot.com

aditya sanas

unread,
Jul 6, 2010, 12:09:23 AM7/6/10
to google-we...@googlegroups.com
you can set buttons ID by the method getElement().setId();

you can set Id as row number and as whenever button get clicked you will have to check its id by

getElement().getId() which is row number that we had set.


--
Aditya


--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

Sunny

unread,
Jul 7, 2010, 12:21:28 AM7/7/10
to Google Web Toolkit
hi Vik,

try
FlexCellFormatter formatter =
FlexTable.getCellFormatter().getRowNum();

hope this helps

Sunny.

On Jul 6, 9:09 am, aditya sanas <007aditya.b...@gmail.com> wrote:
> you can set buttons ID by the method getElement().setId();
>
> you can set Id as row number and as whenever button get clicked you will
> have to check its id by
>
> getElement().getId() which is row number that we had set.
>
> --
> Aditya
>
>
>
> On Mon, Jul 5, 2010 at 8:53 AM, Vik <vik....@gmail.com> wrote:
> > Hie
>
> > I have a table extending a FlexTable.
>
> > In every row there is Button. On clicking this button I want to know the
> > row number of the table. Any idea on how to achieve this?
>
> > Thankx and Regards
>
> > Vik
> > Founder
> >www.sakshum.com
> >www.sakshum.blogspot.com
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Google Web Toolkit" group.
> > To post to this group, send email to google-we...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > google-web-tool...@googlegroups.com<google-web-toolkit%2Bunsubs­cr...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/google-web-toolkit?hl=en.- Hide quoted text -
>
> - Show quoted text -

Professor Vagner

unread,
Jul 7, 2010, 9:05:32 AM7/7/10
to google-we...@googlegroups.com
Hello friends,

try this:

ClickHandler clickHandler = new ClickHandler() {
           
            @Override
            public void onClick(ClickEvent event) {
                com.google.gwt.user.client.ui.HTMLTable.Cell cell = flexTable.getCellForEvent(event);
                Window.alert("Row Index " + cell.getRowIndex());
            }
        };

        Button yourButton1 = new Button("your button 1");
        yourButton1.addClickHandler(clickHandler);
        flexTable.setWidget(0, 0, yourButton1);
       
        Button yourButton2 = new Button("your button 2");
        yourButton2.addClickHandler(clickHandler);
        flexTable.setWidget(1, 0, yourButton2);
       
        Button yourButton3 = new Button("your button 3");
        yourButton3.addClickHandler(clickHandler);
        flexTable.setWidget(2, 0, yourButton3);
       
        Button yourButton4 = new Button("your button 4");
        yourButton4.addClickHandler(clickHandler);
        flexTable.setWidget(3, 0, yourButton4);
       

--
Professor Vagner

O PLANETA É O MEU PAÍS, E A CIÊNCIA É A MINHA RELIGIÃO ! INDO AO INFINITO E ALÉM... !!!!!!
Reply all
Reply to author
Forward
0 new messages