cancel
Showing results for 
Search instead for 
Did you mean: 

set to be first page and first row - Table Elemet

Former Member
0 Kudos

Hi,

Need help and advice on the Table Element

1) What happen is after i execute the webdynpro the page and rows selection is selected based on my last selection, for e.g if i had select page 2 , after i execute again the page its go to the page 2. Not to the page 1.

2) How to set the table to be first page and first row ?

Thanks for your help

Brgds,

Badz

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Check the method SET_FIRST_VISIBLE_ROW of class CL_WD_TABLE, or alternatively you can bind the same property of table to some contex attribute of type I and set it to 1.

Regards

Manas Dua

Former Member
0 Kudos

Hi ,

I try to use the method but there is error " Access via 'NULL' object reference not possible. "

below is my code snippet.



data: obj_table type ref to cl_wd_table,
      elview TYPE REF TO if_wd_view,
      lr_column type ref to cl_wd_table_column,
      lr_column1 type ref to cl_wd_table_column.

obj_table->SET_FIRST_VISIBLE_ROW( '1' ).

  wd_this->fire_op_tomain_plg(
  ).

Former Member
0 Kudos

Hi,

you are getting the dump because the reference obj_table is initial.

So before you call SET_FIRST_VISIBLE_ROW() , you have to get the table instance using somthing like this.

obj_table ?= view->get_element(ID = '<table_id>').
IF obj_table IS NOT INITIAL.
  obj_table->SET_FIRST_VISIBLE_ROW( '1' ).
ENDIF.

The above code is written assuming that you will be coding in WDDOMODIFY() method.

Thanks,

Aditya.

Former Member
0 Kudos
obj_table ?= view->get_element(ID = '<table_id>').

there error on the view interface or class.. as i try to execute this on my event name ClickThis.

Thanks.

Former Member
0 Kudos

Hi,

Since you are writing the code in a handler , "view" will not be available (as it is available only in WDDOMODIFY()).

What you can do is , create a view controller attribute of type IF_WD_VIEW (say current_view ) and assign the value of "view" in WDDOMODIFY view to current_view as ,

wd_this->current_view = view.

and the access the same in your handler using the following code.

wd_this->current_view.

Thanks,

aditya.

Former Member
0 Kudos

Thank you guys,

Ok the table now is back to first page but its pointed to second row not the first row,

any further advice on this are appreciated.

Thanks

Badz

Answers (3)

Answers (3)

Former Member
0 Kudos

the key is

 

obj_table->SET_FIRST_VISIBLE_ROW( '0' ).

Former Member
0 Kudos

Can you try using methods GET_FIRST_VISIBLE_ROW and SET_FIRST_VISIBLE_ROW in class CL_WD_TABLE?

Say, get the value (returning parameter) from GET_FIRST_VISIBLE_ROW in action event that reloads the page, and set it to a local variable or context attribute. Use the same in method call to SET_FIRST_VISIBLE_ROW in modify view method.

You can try binding an attribute of type I to firstVisibleRow, as per this statement from help:

If the firstVisibleRow lies outside of the existing data records, then the first visible row is recalculated internally so that as many rows as possible are visible at the end of the data set. The value however is not written back to the UI element.If the row is actually available in the data records, but the following data records are not sufficient to fill all the rows, empty rows are displayed for the missing data records. The first visible row is not corrected in this case.

This property, which does not have to be bound, can be changed by the client.See also Properties Used in MultiPane or TablePopin

Best regards,

Chinnu

Former Member
0 Kudos

i'm using it but still the the row is scroll to number 2.. andt it is not highlighted on row 2, it just scroll at row number 2.

it can see on the table footer ROW [2] of 15.

it should be pointed at ROW[1] of 15.

Former Member
0 Kudos

Hi badz lee ,

Try setting the row you want to be highlited to lead selected element. That will make the row highlited.

Best regards,

Chinnu

Madhu2004
Active Contributor
0 Kudos

Use the methjod MOVE_FIRST of IF_WD_CONTEXT_NODE. Then automatically first row wil be sleected.

Former Member
0 Kudos

yes all the syntax give highlighted the first row , but on the display.. it showed row number one

please refer below picture..

after user click submit

http://img529.imageshack.us/i/firstrow.png/

after user click back and submit again, it point to row2 and row1 not displayed

http://img213.imageshack.us/i/secondrow.png/

thanks guys

Former Member
0 Kudos

ok guys thanks, there is error on the coding that is why the first row focus on the line two, the correct code should be:

the first visible row need to set to 0 not 1


obj_table->SET_FIRST_VISIBLE_ROW( '0' ).

Edited by: badz lee on Sep 23, 2010 5:07 AM

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

You know that you really should adjust UI element properties directly outside of WDDOMODIFYVIEW. Capturing the View object and doing so is forbidden because it can cause problems with the phase model. Do so at your own risk.

Furthermore it is really unnecessary. Instead just bind the firstVisibleRow property of the table to a context attribute. You can then adjust this context attribute via normal context APIs at any time. Manipulation of UI elment properties via context binding is very much the recommended approach.

Former Member
0 Kudos

Hi,

Get the table reference from the view. And use method set_First_visible_Row by passing index as 1.

With Regards,

Shridhar