Auto select new item in tree

Hi
I have a tree that i allow user to drag and drop items to it - what is the easiest way so the new item is automatically selected? ie, tree.selectedIndex should point to the new item's index.
Unfortunately it thought this was easy apparently it was not - like if the nodes in the tree control are collapsed, the selectedIndex is different than when all the nodes are expanded.
Do note that the way i populate my tree is through a data provider - so i populate a class that would become the tree's data provider, so when the tree refreshes, i simply do this:
myTree.dataProvider = project.p;   
I can track where my new item was inserted in my "project" instance - but like i said earlier, the tree itself have different selectedIndex when the nodes are collapsed and when they are not.
THanks

Hi,
I just posted a demo and source code on my blog: Auto select New Item in Tree component
In above example i use loopAndFind() custom function.
Hope it helps!
Mariush T.
Blog: http://mariusht.com/blog/

Similar Messages

  • Select new row in tree after add

    In quite a few of our pages in our application we have trees and tree tables that can have rows added through separate popup windows. After the user successfully adds the record and closes the popup the tree/treetable is refreshed properly, however we also want the new node/row to be selected, and also make sure that it's parent is expanded. We've found a variety of examples of logic that does something close or sort of close, but we're having difficulties. Is there any easy or even moderate way to find a node/row in a tree based on the VO's primary key or some other value? I think I know how to make the found node/row selected and it's parent expanded, but how do I find the node/row? I keep running into issues because the tree isn't necessarily completely expanded or because the range of rows in the iterator isn't huge and the new row isn't in the initial range of rows pulled back.

    Hi,
    I just posted a demo and source code on my blog: Auto select New Item in Tree component
    In above example i use loopAndFind() custom function.
    Hope it helps!
    Mariush T.
    Blog: http://mariusht.com/blog/

  • Auto select an item in a child node of a TreeView UI control?

    Hi There,
    I'm having some issues with a TreeView control in my UI that I cannot seem to resolve, and thought I would ask if anybody here has done this type of thing.  My TreeView is made up of a collection of nodes, each with some child items.  When the window containing the TreeView displays, I populate it with the nodes.  I want to be able to script the selection within the TreeView, but I want the script to select a child items, not just their parent nodes.  Is this possible?  I know it is possible to selecting the parent nodes in a TreeView, but I cannot seem to get the code for selecting, via scripting, a child item of a node in a TreeView.  Any thoughts on how to acheive this?
    Thanks for your time and help!
    Best,
    Arie
    Here is some of the code I am using for auto-selecting child items of nodes in the TreeView:
                        //Code to populate the TreeView (picker) goes here
                        //Highlight the last selection
                        for (var i=0; i < picker.items.length; i++)
                            if (picker.items[i].title == SAVED_TITLE){
                                picker.selection = picker.items[i];
                                picker.selection.expanded = true;
                                for (var x=0; x < picker.selection.items.length; x++) {
                                    if (picker.selection.items[x].marker == SAVED_MARKER){
                                        picker.selection = picker.selection.items[x];  //turns out the indices are relative to it's parent, not the picker's indices
                                        break;
                                break;

    I had some of the above code wrong:
        // function to filter jsx files------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------ -----------------------//
        function filterJSXFiles(file)
            return ((file.name.match(/.jsx(bin)?$/) != null) && (file.name != (new File($.fileName)).name));
        // Collect files in folder that holds Burrow AFX scripts---------------------------------------------------------------------------------- -----------------------------------------------------------------------------//
        var brws_ScriptFolder = "Z:\\apps\\after_effects\\AFX_Scripts\\"; 
        //print(brws_ScriptFolder)
        if (brws_ScriptFolder != null)
             var fileList = Folder(brws_ScriptFolder).getFiles(filterJSXFiles);
             //print( fileList)
            function myScript(thisObj){
            function myScript_BuildUI(thisObj){
                var myPanel = (thisObj instanceof Panel) ? thisObj : new Window("palette", "AFX SCripts", undefined, {resizeable:true});           
                res = "group{orientation:'row', alignment:['fill', 'fill'] , alignChildren:['fill', 'fill'], \
                    groupOne: Group{orientation:'column', alignment:['fill', 'fill'] , alignChildren:['fill', 'fill'], myMultiTreeView: TreeView{}   }     }     }"; // creating a resource string, controls go here
                myPanel.grp = myPanel.add(res);           
                var brws_ScripIconsDir = "Z:\\apps\\after_effects\\burrowsAFX_Script_Icons\\burrowsIconForAFX\\";   
                var jsxExt = ".jsx";
                //Add Treeview items and icons------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------ -----//
                var brws_TopNode = myPanel.grp.groupOne.myMultiTreeView.add("node", "Burrows AFX Scripts");
                brws_TopNode.image = File( brws_ScripIconsDir + "BurrowsIcon20x20.png" ); 
                //brws_TopNode.helpTip = "This is the help. Is it not THE greatest thing you have seen?"
                var brws_AsciiGenerator_1_2 = brws_TopNode.add("item", "AsciiGenerator_1_2");     // CURRENTLY THROWS RESOURCE ERROR
                brws_AsciiGenerator_1_2.image = File( brws_ScripIconsDir + "AsciiGenerator_1_2.png");
                // EVENTS----------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------ ---------------------------------//
                myPanel.grp.groupOne.myMultiTreeView.addEventListener('change', function (event)
                         if (myPanel.grp.groupOne.myMultiTreeView.selection.text ===  'AsciiGenerator_1_2') { fn_AsciiGenerator_1_2(); }
                   }, false);// End of Event Listener
                function fn_AsciiGenerator_1_2()
                    var asciiGenLoc = (brws_ScriptFolder + "AsciiGenerator_1_2" + jsxExt);
                    var scr_asciiGenLoc =  new File(asciiGenLoc);
                    if (scr_asciiGenLoc.exists) { scr_asciiGenLoc.open("r"); var scriptContent = scr_asciiGenLoc.read(); scr_asciiGenLoc.close(); eval(scriptContent); }
                    myPanel.grp.groupOne.myMultiTreeView.selection = brws_TopNode;
                //Setup panel sizing----------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------ --------------------//
                myPanel.layout.layout(true);
                myPanel.grp.minimumSize = myPanel.grp.size;
                //Make panel resizeable------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------ ------------------//
                myPanel.layout.resize();
                myPanel.onResizing = myPanel.onResize = function(){this.layout.resize()}           
                return myPanel;            
                }// End of myScript_BuildUI------------------------------------------------------------------------- ------------------------------------------------------------------------------------------ -------------------// 
            // Create the UI--------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------ --------------------------//
            var myScriptPal = myScript_BuildUI (thisObj)
            if( (myScriptPal != null) && (myScriptPal instanceof Window) )
                myScriptPal.center();
                myScriptPal.show();
            }// End of if Statement-------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------ ---------------------//
            }// End of myScript function
    myScript(this);
    }// End of script

  • Passing Multiple Selected List Items to a "New Item" Form in Another List with Multiselect Lookup Field

    Hi!
    Version Info:  SharePoint 2013 Server Standard (*BTW...I do not have access to Visual Studio*)
    I have two lists, let's call them
    -Assets
    -Asset Checkouts
    "Assets" is the parent list, and "Asset Checkouts" has a lookup column (multiselect) which is tied to the serial # column in the "Assets" list.
    Basically, what I need to accomplish is this:  I would like to be able to select multiple list items in the "Assets" list, and create a new item in "Asset Checkouts", and pre-fill the multiselect lookup column in the NewItem form
    for "Asset Checkouts" with the values from the selected items in "Assets".
    Any ideas or suggestions on how to do this would be most appreciated!
    Thanks!

    Hi,     
    According your description, you might want to add new item in "Asset Checkouts" list when selecting items in "Assets" list.
    If so, we can achieve it with SharePoint Client Object Model.
    We can add a button in the "Assets" list form page, when selecting items, we can take down the values of columns of the selected items, then click this button which will create
    new item in "Asset Checkouts" list with the values needed.
    Here are some links will provide more information about how to achieve it:
    Use
    SP.ListOperation.Selection.getSelectedItems() Method to get the list items being selected
    http://msdn.microsoft.com/en-us/library/ff409526(v=office.14).aspx
    How to: Create, Update, and Delete List Items Using JavaScript
    http://msdn.microsoft.com/en-us/library/office/hh185011(v=office.14).aspx
    Add ListItem with Lookup Field using Client Object Model (ECMA)
    http://notuserfriendly.wordpress.com/2013/03/14/add-listitem-with-lookup-field-using-client-object-model-ecma/
    Or if you just want to refer to the other columns in "Assets" list when add new item in "Asset Checkouts" list, we can insert the "Assets" list web part into the NewForm page
    of the "Asset Checkouts" list, then when we add new item in the "Asset Checkouts" list, we will be able to look through the "Assets" list before we select values for the Lookup column.
    To add web part into the NewForm.aspx, we need to find the button "Default New Form" from ribbon under "List" tab, then we can add web part in the NewForm.aspx.
    In the ribbon, click the button “Default New Form”:
    Then we can add web part into NewForm.aspx:
    Best regards
    Patrick Liang
    TechNet Community Support

  • You should run a new contract selection for item 0000000010

    Hello Friends
    i am trying to create a service request from WEB IC by confirming Account and Ibase and able to create without error.
    if i end session and open the service request in change mode and if delete the ibase and save, then appeas the below message
    "You should run a new contract selection for item 0000000010", going through OSS notes, but found nothing.
    Transaction type ZXXX : we set
    Contract Determination is set to 'E' : Assign at Item leve : Assign immediately if unique for .
    if i open the service ticket in CRMD_ORDER and go in change mode if i click process action button next to error, this will disappear. but it comes when i assing a ibase to the request, so its working only when i first create without errors.
    users do not use crmd_order to process error and WEB CI does not have process action feature.
    any sort of help will be appreciated.
    Thanks
    Gopi

    Hi Gopi,
    Which release are you using ?
    This message appears when you change any field in the service ticket which has an influence on contract determination, such as ibase, ibase component, line item, ...
    As of CRM2007 we have enabled a hyperlink for this message. Clicking the hyperlink will re-execute the contract selection.
    Regards
    Gert

  • The following error occurs after Goodle News loads and I try to use the cursor to select a news item Script: chrome://vidbar/content/downloader.js:107

    Updated to the latest Version of Firefox and checked for updates on all apps but no change and the error occurs every time I select a news item or try to scan down or up the page.

    That issue is caused by the vidbar extension
    *https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes
    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.com/kb/Safe+Mode

  • 6.1 Print Templates - auto select items in the print dialog popup

    In the slide deck I have about 6.1 it says the following:
    •Print Templates
    –Print templates can now be used to auto select items in the
    print dialog popup. By default, the out of the box template
    selects the current specification
    Unfortunately I haven't been able to find how to do this in the EP documentation. Could someone point me in the right direction on how to do this?

    Download Extensibility Pack 2.6. It was just released. Take a look at page 11 in the Print Extensibility Guide. It should have the info you need. If not let me know.
    Here is the link for the downloads:
    https://support.oracle.com/CSP/ui/flash.html#tab=PatchHomePage(page=PatchHomePage&id=h1j503ev())

  • Since upgrading to Firefox 4 I've been unable to select search items from the google drop down box in the toolbar. Instead, I have to retype my search item completely as I also unable to select 'auto-complete' items as they appear.

    Since upgrading to Firefox 4 I've been unable to select search items from the google drop down box in the toolbar. Instead, I have to retype my search item completely as I also unable to select 'auto-complete' items as they appear.

    Known problem with the Google Toolbar extension. <br />
    http://www.google.com/support/toolbar/bin/static.py?page=known_issues.cs

  • How to programmatically select an item of a tree?

    I,
    I have a vi that I want to use only with a keyboard. There is a tree in this one. In this vi we can select an item, with the arrows of the keyboard, and put the color of the item background red or green.
    After a loop to put all red, (property node, ActiveItem->Line and ActiveCell->background color), the active item is the last of the tree, but the selected item isn't the same. If I set the Active Item to 0 after the loop, and then I press down arrow of the keyboard, the item selected will be the next after the one before the loop, and it's not from the start of the tree.
    (Sorry for the English)
    I want to select a Cell Prgrammatically but I didn't find anything in the property or Invoke nodes...
    Thanks a lot.
    Barto

    Here is the little program who illustrates my answer.
    Thanks for helping me.
    Barto
    Message Edité par Barto le 01-31-2007 07:55 AM
    Attachments:
    Tree problems.vi ‏16 KB

  • New "long pause" when I'm trying to select an item from a long menu?

    So, just in the past few days whenever I try to select an item out of a long menu, I'm unable to select it until after a long pause of approx 30 seconds. For example, in Handbrake if I scroll through chapters and want to pick a certain chapter, the program sits for about 30 seconds before it will select the chapter.
    This has also happened in Itunes when I'm trying to select a genre. It will allow me to scroll all the way down with no problem but when I try to select the genre it sits there for about 30 seconds before doing anything.
    Anybody else having this issue? Any fixes?
    Thanks.

    nobody else having this happen?

  • Playlist does not contain new items after sync.

    We recently pruchased 4 new songs from iTunes on the iPhone.
    All 4 songs were successfully downloaded.  We Sync'd the iPhone with iTunes on a Windows PC.  All 4 songs are now in the library on the PC.
    We then used iTunes on the PC to add the 4 new items to an existing playlist.  For what it is worth, we do all our playlist maintenance on the PC and then sync back onto the iPhone and our iPad because we find playlist maintentance on both mobile devices very clunky and time-consuming.
    Once we added the 4 items to the playlist, we then sync'd the iPhone and the iPad with the PC again.  It all went smoothly as normal.  The new songs are in the 'songs' list on both the iPhone and the iPad.  However, the playlists do not contain all the songs on either devices.
    The iPad sync options are set to sync the entire music library.  The iPhone sync options are set to only sync specific playlists - and I checked that the playlist that contained the new songs was selected for the iPhone.
    I tried creating a new playlist on the PC with just the 4 new songs and sync'd it with the iPad - the new playlist appeared on the iPad, but it only had 1 of the 4 songs in it.
    I added the same *new* playlist to the selected set of playlists to sync for the iPhone.  The playlist appeared on the iPhone, but this time with 3 of the 4 songs (one missing).  Random!  Worse, frustrating!
    When I expand the device tree in iTunes on the PC (with the device still connected) to see what it thinks is in the playlist on the device, it always shows the correct content - but when you look on the actual device the content varies as above.
    Can anyone shed some light on what has happened here, and preferrably, how I stop this random behavior and get this all back on track.
    I believe all the software and all devices is up to date.  I am running iTunes 11.1.3.8 on Windows.
    Thanks in advance for any help.

    *** Update ***
    We purchased another song on iTunes today.  We added it to one of our playlists on the PC and sync'd the iPad.  On this occasion the four songs we added to playlists yesterday all sync'd correctly.  However the new song we purchased today did not sync into the playlist.  I can't imagine why, but is there some kind of delay built into the sync'ing mechanism somewhere?

  • How do I stop auto select or hovering with my trackpad?

    How do I stop my track pad / mouse from auto select (Hovering)?

    I've been having this problem on my MacBookPro for some time. I live in China.  In January I took it in to the Genius'  in California and they replaced the trackpad.
    I think it's a software problem. I continue to have this problem in Firefox and Safari. I use a VPN and I also check preroidically for viruses. I have a clean computer with no viruses. I don't open spam, links or attachments from anyone I don't know well or recognize. My computer is clean.
    I use the latest versions of OS and update my software when there are new updates. I'm using 10.8.2. Haven't added 10.8.3 yet but will do so as soon as I see that it is stable.
    This problem is quite frustrating. When reading and scrolling down a page of news a new item is selected or text is selected without a click. Sometimes I will be taken to a new page without having clicked anything.
    It's quite a hassle sometimes.
    Apple hasn't helped at all with this.

  • Auto selection of file from folder during uploading??

    Hi all friends,
    Iam facing with one problem I am developing one uploading software for that i have used swing and servlet.Now my problem is i want to give auto selection of file from one folder means user just copy the files from any computer on network and paste it in predefind folder.And when they click on upload button it should start uploading of file one by one and after completion of uploading it move that file into another folder one by one.Now my software doing it perfectly but if user copy and paste any file in that predifined folder from network computer during uploading then they have to click upload button again after completion of first queue of files(for example if user first copy 10 files and start uploading and inbetween uploading of that 10 files if user copy another 10 files from network computer then they have to click on upload button again after completion of uploading of first 10 files).But my user requirement is they want to click on upload button once only at the time of starting my application and my application automatically select the file one by one from folder and send it to destination.Means if they copy the file from network machine inbetween uploading or any other user from network send file in that folder then my application should select those file automatically and start uploading means they don't want to click on upload button again.Can any one plz guide how I can slove this problem.Below r my codes:-
    Upload.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
    try {
    suspendflag=true;
    Resume.setEnabled(false);
    Suspend.setEnabled(false);
    dest=frame.m_txtURL.getText();
    File ff=new File("d:\\DTMS\\Upload");
    File[] files = ff.listFiles();
    fileList = new Vector();
    if(files == null)
    textArea.append("There is no file");
    return;
    else
    for (int j = 0 ; j< files.length ; j++)
    fileList.add(files[j]);
    java.util.Collections.sort(fileList, new FileComp());//sorting by size
    new Thread(new Runnable() {
    public void run(){
    for (int k = 0; k < fileList.size(); k++)//loop for queue {
    File fname = (File)fileList.get(k);
    String str=fname.getName();
    log("Destination:" +" "+ dest);
    log("Uploading Progress\nPlease Wait....");
    result=doPost(fname,dest);//method for read file & send to servlet
    String str2="Transfer apparently failed.";
    String str3=result;
    if(str2.equals(str3)){
    Error(result);
    else if(suspendflag==true){
    File newfile =new File("d:\\DTMS\\Archives\\"+str);
    fname.renameTo(newfile);
    log("File" +" "+ str+" "+"Upload Completed !");
    else if(suspendflag==false){
    Error("** Transfer Suspended**");
    }).start();
    }catch(Exception exp)
    Error("Error : " + exp.toString());
    Regards
    Bikash

    Hi Chandan,
                        All the multiselection files are stored in it_tab( i:e file_table in method). you need to loop the every record to upload the data for selected files. please check the code Below...
    DATA: file_str1 type string.
    data: it_tab TYPE STANDARD TABLE OF file_table,
           wa_tab TYPE file_table,
           lw_file LIKE LINE OF it_tab,
           gd_subrc TYPE i.
    SELECTION-SCREEN begin of block blk with frame title text-100.
    SELECTION-SCREEN SKIP 2.
    parameters : p_file like rlgrap-filename .
    SELECTION-SCREEN end of block blk.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
    CALL METHOD cl_gui_frontend_services=>file_open_dialog
    EXPORTING
    window_title = 'Select only Text File'
    default_filename = '.azt'
    multiselection = 'X'
    CHANGING
    file_table = it_tab
    rc = gd_subrc.
    *READ TABLE it_tab INTO lw_file INDEX 1.
    *p_file = lw_file-FILENAME.
    Start-of-Selection.
    loop at it_tab INTO wa_tab.
       file_str1 = wa_tab-FILENAME.
    CALL FUNCTION 'GUI_UPLOAD'
       EXPORTING
         filename                      = file_str1
    *    filename                      = '\\10.10.1.92\Volume_1\_projekte\Zeiterfassung-SAP\test.azt'
       tables
         data_tab                      = it_string
    IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDLOOP.

  • Passing DB values to the textbox based on Select Value item

    Hi,
    I am very much new to the Oracle APEX. In my project, I have a requirement wherein I have to pass the different values to the corresponding textboxes on a different page based on the value I select from the "Select Value" item.
    I have tried using calling On-Demand Processes, but couldn't get the desired result.
    Please suggest!

    Hi 796444 ,
    Welcome to the forum. It will be good if you familiarize yourself with the forum ettiquittes. Also, when posting always state the following:
    a. Apex version
    b. DB version
    c. Web server ; EPG, apexlistener, etc
    d. Provide adequate details for others to understand your problem / what you are trying to achieve.
    e. Any code snippets you post should be enclosed in a pair of tags
    If your current problem is that the you are *calling* Page 2 from Page 1, and while doing so you want the value of P1_ITEM1 to be passed and set in p2_ITEM1 then
    a. Edit the branch
    b. In Action in Set these items write P2_ITEM1
    c. In With these values write &P1_ITEM1. (do not miss the dot at the end)
    It looks good if you use a better handle than 796444 :-)
    Regards,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to understand the "New Item" icon at the bottom of the Project window

    I'm trying to understand that small "New Item" box at the bottom of the project window better. I'm aware that when I bring video clips into my project, if I drag them to this box, PPCS5 will add them to the timeline. I partially understand the positive reasons for doing so, primarily that PPCS5 will correctly identify the type of video being brought into the project. I know that if I select all my clips and drag them to the new item box, that all my clips will be added to the timeline at the same time and all together on the timeline. There are many things I don't understand about it. If I add my clips one by one using the "New Item" icon, they will show up as separate sequences on the timeline. If you try to add another clip at a later time, can that clip not be added using the "New Item" box?  One other question is what would be the advantage in putting clips on the timeline as separate sequences? And one further question is do you drag other items to this box besides video clips? Like music, and still images?

    Dragging something to the New Item icon doesn't just add that something to a sequence.  It actually creates the correct sequence for the something to be added to.
    You do this once, when you need a new sequence.  Anything else you want to add to that sequence you do by other means.

Maybe you are looking for