on 2004 Sep 24 10:36 AM
Hi,
I sorted my tableview by SERVER. This is working fine, however when I add a row problems start. My navigationmode is BYPAGE and I want to show the added row and select it. Selection I think I can manage with the attribute selectedRowkey, however to set the visibleFirstRow is a problem.
This attribute needs to be set before the call view. However the data is not sorted yet, so the index supplied is wrong.
Anyone any suggestions besides set sort to APPLICATION and do it myself?
Request clarification before answering.
All of what you ask is not really possible. The very moment that you sort a table, all the index related stuff makes no sense. So, what you should do is use keys as much as possible, especially when setting the selected row, etc. You might have to also set (or reset) the first visible row to show you selected row (if this is important for you).
To set the visibleRow, do a READ TABLE with the key, and TRANSPORTING NO FIELDS. Then you can look at sy-tabix to have the index in the newly sorted table of where your selected row will be use. Use this as the first visible row.
Also look at SBSPEXT_TABLE for ideas.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Brian,
Maybe I stated it not all clear, but that is exactly what I did. So let me try to give an example.
Item 1
Key = 001
Date = 21.08.2004
Category = B
Item 2
Key = 002
Date = 22.08.2004
Category = C
Item 3
Key = 003
Date = 23.08.2004
Category = A
In the view selectedRowKey is set to field Key, and this works fine.
Lets say the visible rowcount is set to 2, and sort is on Date and Item 3 is selected.
Now I sort on category. I read the data binded table just before the call view. Problem is Item 3 is still at tabix 3. If I look at my table just after the call view, Item 3 is at tabix 1. Only now I cannot set the firstvisiblerow anymore.
Greetings,
Vincent
Hmmm... I read the text, but I failed to understand all of your remarks. Unfortunately the written word requires a lot more detail to paint the picture. We see the data. Who does the sorting where? What is the data binded table? Is there now suddenly also a selection problem? Why are we even talking about tabix here. We agreed that we are actually only interested in keys. So after sorting, the selected row still have key=003. So we now reread the table to find out that key=003 is on tabix=1 (this is only case where we want to have a tabix). So we set firstVisibleRow=tabix.
Maybe you can reduce your problem to about 25-50 lines of code. Use only one table, fill table with three items below. Show event handling and your sort logic.
Then we can paste into a test page and just understand where the road should have been.
| User | Count |
|---|---|
| 8 | |
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.