cancel
Showing results for 
Search instead for 
Did you mean: 

How to hide a row of a table ?

former_member212767
Participant
0 Kudos

Hi,

I would like to hide some rows in a table. I know how to delete the rows, but that does not help as I would like to save the all the data (also the hidden rows) to R/3. That means I want to retain all the data and only show parts of it to the users.

An example follows (2 tables, master/detail):

Data consists of 10 rows (detail).

Master table has 3 lines. By clicking on one of these rows the detail table shows only rows belonging to the selected master row of the 10 detail rows that exist. All other rows are hidden. By clicking save I would like to save ALL the data to R/3, also the hidden rows.

Could I do this with a filter ? I tried the context type visibility thing (WDVisibility.NONE) but that does not seem to work for rows.

Should I use a cache of all the data and then save that instead of the shown data ?

(sidenote: I've managed to make this master/detail to work by deleting the details lines from the detail table, so I don't have problems with the events or the master/detail setting as it is)

Any help greatly appreciated!

Kind Regards,

Jari Pakarinen

Accepted Solutions (1)

Accepted Solutions (1)

former_member212767
Participant
0 Kudos

(I'm replying to myself...)

Could I do this so that I create a visibilty context attribute and map it to all the fields of the table and set the fields to WDVisibility.NONE when I don't want to see them ?

Jari

Former Member
0 Kudos

Hello,

in my opnion you should separate between Component Controller and View Controller data.

The component controller should contain all data of all 10 Details rows and you should save that.

In the view controller you should show only the seletced detail rows by filling the context node of the second table with only the lines that belong to the selection.

You can do either a complete refill or you can set the node of your second table to non-singleton and have one node for all possible selections.

Best regards,

Frank

Answers (3)

Answers (3)

former_member212767
Participant
0 Kudos

Hi,

This is how I did it:

Component controller context (the model from RFC) has the data. I created two additional 'copies' (model node and value attributes under it) of the data structure to the context and copied the data I needed to these structures. Then I set up the tables in the view, and mapped the fields to these newly created structures.

That is: tables get their data from nodes I created and fill from code.

Hope that made any sense It is now working anyway, so thank you.

Regards,

Jari

Former Member
0 Kudos

hi jari,

what i think is create two nodes of same in the view contest and bind these nodes to 2 tables you created.

now hide the second table using WDvisibility.none.

when user selects rows some event will be triggered.

in that event handler add selected rows to second table.

(using the code what nibu mentioned)

bind the first table context to customcontroller context

i hope this will work fine.

regards

balu

Former Member
0 Kudos

Hi Jari,

You can achieve the required functionality through what Frank has suggested. For this, the following code snippet may help you. (I'm pasting here the code that I had given for a similar query)

Let's say you have the table bound to a node 'table_node' in view 'A' and you want to show only the selected rows of this table in another table of view 'B'. Create a similar node (with same structure) in your component controller and map it to view 'B'. Let's call this node 'display_node'. (No mapping between 'table_node' and 'display_node'). Now do the following :

1) make sure that 'selection' for 'table_node' is 0..n or 1..n.

2) set the 'selectionMode' of the table in view 'A' as multi.

3) You might be using some button or other UI element to trigger the action. In the action handler, write the following:

IPublic<your controller name>.IDisplay_NodeElement comp_elmt = null;

IPrivateViewA.ITable_nodeElement elmt = null;

for(int i=0;i<wdContext.nodeTable_node().size();i++)

{

if(wdContext.nodeTable_node().isMultiSelected(i))

{

elmt = wdContext.nodeTable_node().getTable_nodeElementAt(i);

comp_elmt = wdThis.wdGet<your controller name>().wdGetContext().createDisplay_NodeElement();

comp_elmt.set<attribute name>(elmt.get<attribute name>);

wdThis.wdGet<your controller name>().wdGetContext().nodeDisplay_Node().addElement(comp_elmt);

}

}

Now fire the plug to the second view which will show you the selected values only. (ofcourse you should have created a table and bound it to 'display_node').

Hope this helps,

Best regards,

Nibu

former_member212767
Participant
0 Kudos

Hi,

Thanks. If I got you right, your explanation has two views on separate pages, i.e. from the first table user goes to the second table. This means user sees one table at a time.

However I would like to show the tables on one view, i.e. two at a time.

Is that possible with your example ?

Rgards,

Jari

Former Member
0 Kudos

Hi Jari,

Yes, you are right. The solution proposed needs the tables to be in two different views. In WebDynpro, there is no direct way to hide the rows of a table. If you need the two tables in the same view, you need to make use of another node with similar structure to the 'details' node. Each time the user selects a row in the master table, find the corresponding element in the details node, clear the newly created duplicate node, and then copy only that element to the new node. And bind the details table to this node.

Hope this helps,

Best Regards,

Nibu.