Skip to Content

How to hide a row of a table ?

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    Posted on Sep 20, 2005 at 12:22 PM

    (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

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      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

  • author's profile photo Former Member
    Former Member
    Posted on Sep 20, 2005 at 12:57 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      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.

  • author's profile photo Former Member
    Former Member
    Posted on Sep 26, 2005 at 02:58 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 29, 2005 at 05:42 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.