How to block lead selection change in a tree ?

Hi Guys,
<u>Scenario</u>
I have MasterTree - DetailEditor pair. <i>MasterTree</i> is used to visit some tree-structured data and <i>DetailEditor</i> is used to edit currently selected tree node.
<u>Requirement</u>
If currently selected node data is updated through <i>DetailEditor</i> and needs to be saved, than on a subsequent tree selection change the user should be warned about unsaved data.
<u>Implementation</u>
In <b>onAction</b> event handler of <i>MasterTree</i> I check whether last selected node data is updated and needs to be saved and if this is the case rollback <i>treeSelection</i> to that node. On the time <b>onAction</b> event handler is called the tree selection is changed from the node that needs save to the newly selected node. In order to rollback <i>treeSelection</i> I need to introduce variable referencing last selected tree node.
<u>Question</u>
Is there any other technique to implement above scenario without using additional variable and manually rollback <i>treeSelection</i> ? For example, to plug in WDP framework on validation step just before lead selection is changed.
Thanks in advance

Alex,
Here is a link to the phase model of WD:
http://help.sap.com/saphelp_nw04/helpdata/en/b8/cd96edb9c8794aa362e6e8b4236a1f/frameset.htm
There aren't any hooks provided prior to the event handlers being called. As far as I can tell, the way you are handling it is the only way that will work.
-Cindy

Similar Messages

  • How to write lead selection method for a  tree by nesting table column

    Hi,
    I have implemented a table with TreeByNestingTableColumn(To show the tree structure in the table).I am not able to get the selected row element in lead selection method.(I am able to get parent element.) .
    could anyone please tell me about this code?
    BR,
    Ashish

    Hi,
    Follow the below steps to the solution for your problem
    1. Create Action "LeadSelection" in View with parameter (name : 'seletedItem'
    and type : I<your node>Element
    2. Bind this action to Table property "onLeadSelec"
    3. In wdModify()
         IWDTable table = (IWDTable) view.getElement("Your table id");
         table.mappingOfOnLeadSelect().addSourceMapping("nodeElement", "selectedEle");
    4. In onActionLeadSelection()
         wdComponentAPI.getMessageManager().reportSuccess("Selected Item : "+selectedEle.get<Your Node Attribute>());
    Let me know if you need more clarification
    Thanks

  • How can we show selected values of a tree in a selectmanylistbox

    how can we show selected values of a tree in a selectmanylistbox??

    Hi,
    you can use a reference to a RichTree component instance and call  getSelectedRowKeys on it. The selected rowKey then allow you to look-uo the nodes in the tree. You can use a custom selection listener on the tree to be notified about each selection. There also is an API for the de-selected row keys, which you need to remove nodes from the select many list. The select many list will get its data from a managed bean in view scope (so the values survive subsequent requests)
    Frank

  • How to prevent action (lead selection change) with popup (confirmation)?

    Hello all,
    I have an application where I want the user to confirm when he selects a new line in a table. When the user selects a new line in the table an other used component reloads its data based on the new line selected. If the user has not pressed the save button before selecting a new line, any changes in the used component will be lost.
    Currently I use onLeadSelect action on the table to call the load_data method(id=xxx) on the used component in order to display data relevant for id=xxx based the new line.
    I can open a popup to confirm from the onLeadSelect-action or the WDDoBeforeAction, but the action still happens; it doesn't wait for the user to respond. And then any changes are lost...
    I may have to store the parameters sent to the onLeadSelect method in context and continue when the button action from the pop-up returns via subscribed method, but I think this is an unelegant way of doing this.
    There must be a better way...? Any ideas?
    Regards,
    Christian Frier

    on the lead select event handler you can show the popup and no other logic. Move your logic to the ok and cancel button handlers of the pop up.

  • Automatic lead selection change line in WD table

    Hi all,
    In footer of WD table, there is an input field, where user can specify number of record, which will be shown in first visible line.   
    I need to automatically select this line as lead selection. How can I achieve this behaviour? ( I'm using NW 2004 SP 19)
    Thanks for any answer.
    Regards,
    Juraj

    Hi Juraj,
    Assuming that when first time the view containing the table is loaded their is no changes required.
    Only when you enter some value in the input field then that record should be shown as first visible row ans should be lead selected.
    Now,
    1. Create a context attribute ctx_rowinput.Bind this context to the input field.
    2. Create a action say onInputShow and associate this with the input field.
        Either use a button and associate the action to the button or OnEnter event of input field.
    3. In your action onInputShow();
      public void onActionInputShow(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        int i = wdContext.currentContextElement().getctx_rowinput();
        wdContext.node<table node>().setLeadSelection(i);
    4. In your wdDoModifyView add the following code
      public static void wdDoModifyView(IPrivateTest_Table_View wdThis, IPrivateTest_Table_View.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)
        //@@begin wdDoModifyView
        if(!firstTime)
              IWDTable table =(IWDTable)view.getElement("Table");
              table.setFirstVisibleRow(wdContext.currentContextElement().getctx_rowinput());
        //@@end
    <b>Note: If you enter 3 in the input field it will show 2 record as the node index
    starts from 0.And also before setting the leadselection and visible row check if
    the input value exceeds the nuber of rows in the table.</b>
    This has worked for me.

  • How to display lead selection ONLY in the ALV

    HI All,
       User would like display the selected records in ALV . 
       i suggested that add two button - "Display ALL" & "Display Selected" .
       How can i only display the lead selection only in the ALV? or Hide un-selected records.
       Please help.
    Thank you so much
    Gordon

    Hi,
    Pelase have a look.. same requirement.
    get_selected_elements method for ALV
    Re: select rows in alv and show them in another alv in another view
    Web dynpro ALV table copy selected row
    cheers,
    Kris.

  • TreeByNestingTableColumn - how to set lead selection?

    Hallo Guys!
    I am using TreeByNestingTableColumn in my project. I am searching for a way to select a certain context element inside of the tree shown in such a table. I actually know that setLeadSelection doesn’t work properly in such a case.
    I’ve already read this very helpful blog /people/valery.silaev/blog/2005/06/20/master-of-columns-part-ii searching for a solution, but its seemed not to be there.
    Valery had shown how to read the selected context element recursively, but there is nothing about to how to set the needed lead selection for a certain one.
    In my scenario, I am loading the whole table (10-15 elements) with only two levels of hierarchy. After the user clicks on a button I have to reload this table but keep the selection of the previously selected element.
    The try using getTreeSelection didn’t succeed either.
    Any ideas?
    Many Thanks
    Dimitri
    Edited by: Dmytro Lubenskyy on Apr 1, 2008 3:44 PM

    Hi,
    You can use the following methods to set the selection.
    IWDNodeElement nodeElement = wdContext.nodeOrders().getElementAt(2);
           wdContext.nodeOrders().setTreeSelection(nodeElement);
    Regards
    Ayyapparaj

  • How to remove lead selection in table dynamically

    I have a table in webdynpro which allows multiple selections of row. I have a button which is supposed to be clicked after selecting single or multiple rows. After clicking on the button I want to remove the lead selection of the  selected rows (which is shown in golden color for each selected row) .
    I tried REMOVE_SELECTED ELEMENTS and it works fine but only if i select the row by pressing CTRL. If i had selected a single row by just a mouse click (without ctrl) then it wont work.
    THANKS

    Hallo Amber,
    If_wd_context_node has static attribute no_selection. use that to clear the lead_selection_index.
    node->set-lead_selection_index(  if_wd_context_node=>no_selection ).

  • How to do lead select and double click on a row of table simultaniously ?

    Hello All,
    I am creating a freely programmed search help to search Material Number.
    i am displaying the values in normal table ( Not ALV ) on the search help popup.
    My requirement is
    when I select a row and click on OK button the Material number in that row is getting captured ( This is working fine for me)
    At the same time I also want to capture the value when user double cluck on the particular row.
    I am not able to do both on action methods simultaneously as I am getting syntactic error.
    i.e. When I create action method on the event "on_lead_select" and the event "On select"  and try to save Check & activate it throws error.
    Please find the screen shot below.
    Standard webdynpro component WDR_F4_ELEMENTARY was able to achieve this functionality some how, I have debugged it but didn't get the solution

    Hi,
    There is no double click provision. In the table you could change the cell editor of column to LinktoAction UI, then onclick of that you can set the selected value.  And in the component WDR_F4_ELEMENTARY its not a normal table UI but its a CTable UI, you can try creating a CTable and create an Action for onSelect.
    Regards,
    Kiran

  • How to keep lead selections in alv table...

    Hi experts.
    I made a alv.
    A logic  in wdmodifyview is following..
    METHOD wddomodifyview .
      IF first_time EQ abap_true.
        wd_comp_controller->set_alv_config( ).
      ENDIF.
      wd_this->set_maktx( ).  "<- for displaying maktx
    ENDMETHOD.
    When I want to select a line, do not selected.
    I know because of "wd_this->set_maktx( )." sentence.
    But I want to select multi lines in above condition...
    How to keep selected lines in alv?
    Help me please.
    Thanks.
    Regards.

    What logic is taking place in wd_this->set_maktx( )?  It is pretty difficult to say what is causing the issue without knowing what code you are executing?  If you are resetting the context bound to the ALV, that would explain why you are losing your selections.

  • How the Block to do changes in partucular BOM Assemblies

    Dear Expert,
           In our scenario BOM variant are there for country specific. so my client  requirement is once they freeze Bill of Material (BOM) i.e. particular date for single country variant then no changes can be made for this country specific variant up to one month or some period.
    Second requirement is if they want to do some changes in same variant after some days then this change should not be reflected now this chnage should reflected after one month or after some period i.e. from BOM Freezing date. so please tell me any standard functionality is there or if not possible then how we do this development.
    Regards,
    Ishwar

    Ishwar,
    SAP is to enable perform the actual business transactions captured through transactions, it cannot be used as a software to discpline employees or operators.
    Behaviour or organisation Change management should be applied within your company ....SAP wont help in this.
    Regards,
    Prasobh

  • I have version3.6.12 and want to know how to block pictures selectively like I could with adblock with earlier version

    I used to be able to right click on an unwanted image and remove it, but as I updated to a newer version of Firefox the feature no longer works.
    What other option exists?

    See the article at:
    [https://adblockplus.org/en/faq_basics#objects]
    Also, are you using the latest version of AdBlock Plus?
    davewdan

  • How we know the selected node in a Tree object in a form?

    In a TREE object in forms, how can we know the current selected node by clicking a push button.
    lets say , there are 10 nodes in my tree, and 5th one i selected. But i want to store the selected node in a variable, when i click a button.
    please help
    thanks

    Hello
    I've just notice what might be a bug in Oracle forms because when I have the when-tree-node-selected trigger present for the tree (It does not matter if it executes null or some code), the code in option 1 works fine on a when-button-pressed trigger on a button item. This is what I had done to give you a reply.
    My second option will work because you're populating a parameter with when-tree-node-selected trigger which is then readable form anywhere else in the form. All you add is a check on when-button-pressed. Also for bug handling you need to consider setting the value to null when deselecting. I have this option working currently in one of my applications.
    DECLARE
         num_selected NUMBER;
         htree ITEM;
    curren_node FTREE.NODE;
    BEGIN
    htree := find_item('tree.form_list');
    num_selected := ftree.get_tree_property(htree,ftree.selection_count);
    for j in 1..num_selected
    LOOP
    curren_node := ftree.get_tree_selection(htree,j);
    message('hello :'||ftree.Get_Tree_Node_Property(htree,curren_node,ftree.node_value),acknowledge);
    end loop;
    END;     
    cheers
    Q

  • CFDebug says, "widget: Firing selection change event for tree id: t1"

    How do I capture this event and code against it.  Previously used this code to trap click event:
    YAHOO.example.onTreeViewAvailble = function() {
      var curTree=ColdFusion.Tree.getTreeObject('t1');
      curTree.subscribe("labelClick", function(node) {  
       TreeItemClick(1,node.data.id)
      When the tree becomes available (ie. after the page loads),
      this code will run the code above this.
      "t1"- tree name in the cftree tag
    YAHOO.util.Event.onAvailable("t1", YAHOO.example.onTreeViewAvailble); 
    I am obviously not an expert with the Yahoo widgets, but I'm learning.
    This stopped working for some reason.  However the CFDebug consistently shows the subject event happening on every mouse click.  I'd rather just use that.  Any ideas?

    Roy, have you tried to reduce the complexity of your user case?
    Try your use case with a simple page without a region in it first and see if you get the eating them. If yes add a region to your page and verify you get the result you expect. Only then add the portal stuff.
    This will help to narrow down the error.
    Timo

  • WDABAP: note of change of Lead Selection overall component

    Hi,
    I would like to build a similiar wd-application like wd-component 'wdt_master_detail'. There you will see a table with fly-data and below some details of the actual selected row of the table (by lead selection).
    The difference is that I want to seperate the data retrieval in a model-component(z_model) and for the table / details two seperate wd-components(z_table / z_detail) which mapps the fly-data. The wd-application instantiate a wd-component (z_container) which includes in its view z_table and z_detail.
    When the lead selection changes(by selecting a new row in the table of z_table) the details of z_detail should change to the details of the element with the lead selection. But this does not work! By node->get_lead_selection_index in z_detail I get only the inital lead-selection. node->get_lead_selection_index in z_table provides the right index.
    I tried also following: z_table calls z_model->set_lead_selection and this method set the lead selection of the original node new. But this does not help.
    Has someone an idee what I have to do that the component z_detail receive the information? Has the z_model to raise an event with the information of the new index? I hope not.
    Thanks a lot!
    Regards,
    Marcel
    added 1:
    I have an assumption why it does not work:
    Maybe z_table and z_detail instantiates two separate z_model.
    So a solution would be that z_container instantiates z_model and provide this instance to z_table and z_detail but I have absolutly no idee whether and how this could be working... Please kindly help.
    added 2:
    I thinking further a little bit loud...
    I have the idea that z_container mapps the context from z_model and set this these to input-node.
    z_table and z_detail mapps from z_container. ok, if I would like to create many application then I have to create related components(z_comp_appl_xx) and these components includes z_container. This would be maybe the solution if there is a instance problem(see added1) but I have tested and the details screen gets NOT the lead selection
    Message was edited by: Marcel Schreier

    Hi Marcel,
    to extend Thomas comments, here are some suggestions to turn it into code. Hope it helps.
    option A)
    assuming you name the usages in z_container "usage_z_model", "usage_Z_table", "usage_Z_detail":
    in componentcontroller of z_container methode wddoinit() do the following:
    DATA lr_model_usage    TYPE REF TO    if_wd_component_usage.
    lr_model_usage =   wd_this->wd_cpuse_usage_z_model( ).
    IF lr_model_usage->has_active_component( ) IS INITIAL.
      lr_model_usage->create_component( ).
    ENDIF.
    DATA lr_usage    TYPE REF TO    if_wd_component_usage.
    lr_usage =   wd_this->wd_cpuse_usage_z_table( ).
    IF lr_usage->has_active_component( ) IS INITIAL.
      lr_usage->create_component( model_usage = lr_model_usage ).
    ENDIF.
    lr_usage =   wd_this->wd_cpuse_usage_z_detail( ).
    IF lr_usage->has_active_component( ) IS INITIAL.
      lr_usage->create_component( model_usage = lr_model_usage ).
    ENDIF.
    Following this way, it is required to name the usages of z_model in component z_table and z_detail "MODEL_USAGE".
    option B)
    in componentcontroller of z_table and z_detail create an interface-methode set_usage() with one parameter ir_usage type if_wd_component_usage
      DATA lr_usage  TYPE REF TO  if_wd_component_usage.
      lr_usage = wd_this->wd_cpuse_usage_z_model( ).
      lr_usage->enter_referencing_mode( ir_usage ).
    in component z_container method wddoinit() do the following:
    DATA lr_usage    TYPE REF TO    if_wd_component_usage.
    DATA lr_if_ctr_z_table TYPE REF TO iwci_z_table.
    DATA lr_if_ctr_z_detail TYPE REF TO iwci_z_detail.
    DATA lr_model_usage    TYPE REF TO    if_wd_component_usage.
    *-- create instance of z_model
    lr_model_usage =   wd_this->wd_cpuse_usage_z_model( ).
    IF lr_model_usage->has_active_component( ) IS INITIAL.
      lr_model_usage->create_component( ).
    ENDIF.
    *-- create instance of z_table
    lr_usage =   wd_this->wd_cpuse_usage_z_table( ).
    IF lr_usage->has_active_component( ) IS INITIAL.
      lr_usage->create_component( ).
    ENDIF.
    *-- set usage
    lr_if_ctr_z_table =   wd_this->wd_cpifc_usgae_z_table( ).
    lr_if_ctr_z_table->set_usage( model_usage = lr_usage).
    *-- create instance of z_deatil
    lr_usage =   wd_this->wd_cpuse_usage_z_detail( ).
    IF lr_usage->has_active_component( ) IS INITIAL.
      lr_usage->create_component( model_usage = lr_model_usage ).
    ENDIF.
    *-- set usage
    lr_if_ctr_z_detail =   wd_this->wd_cpifc_usage_z_detail( ).
    lr_if_ctr_z_detail->set_usage( model_usage = lr_usage).
    regards, Ulli

Maybe you are looking for

  • Is there an idiots guide to JSF and scope somewhere?

    I am getting very confused with scope and JSF. I have a page that just displays customer details (from CustomerBean extends Customer) with a button that should allow the user to change the customer details. Both pages use the same backing bean (is th

  • Printing Proofsheet for HP Photosmart C6380

    I recently replaced an older HP printer with the C6380.  With my previous printer I could print out a proofsheet to select the prints I wanted to actually print.  Is there a way to do that with the C6380? Thank you 

  • Error while installing SAP Netweaver 7.1 CE Java Trial - MaxDB problem

    Hi All, I am getting following error while installing SAP Netweaver 7.1 CE Java Trial. Execute Command : C:\sapdb\programs\pgm\dbmcli.exe -n psi-001 -d CE1 -u CONTROL,******** db_state Execute Session Command : exit > Subprocess stops at 200805091610

  • How to create an image slideshow?

    Hello, I am a beginner in web design and I need your help somewhere. Please look at the follwoing website: www.safaribig5.com Considering the image slideshow at the top of the home page, how do I add it to a webpage that I'm currently desiging in Dre

  • JDBC connection in EJB

    In EJBs, we can always spawn a JDBC connection using the internal server side driver through defaultConnection() or kprb. My question is, can we spawn any other kind of connection from an EJB to another database on some remote machine, this would inv