<div><div><div>Here's how you can get it from the DOM (this was adapted from common.browser.js)</div><div><br></div><div><div>        if ( params.items.length > 0 ) {</div></div><div>            var itemId = params.items[0];</div>
<div>            var itemName = $('#browseTable tr[type="item"][element="'+itemId+'"] td:first span').html();</div>
<div>            console.log(itemName);</div><div>            var itemNode = $('#browseTable tr[type="item"][element="'+itemId+'"]');</div><div>            var folder = midas.parentOf(itemNode);</div>

<div>            var folderId = '';</div><div>            // we are in a subfolder view and the parent is the current folder</div><div>            if(folder) {</div><div>                folderId = folder.attr('element');</div>

<div>            }</div><div>            else {</div><div>                folderId = json.folder.folder_id;</div><div>            }</div><div>            console.log(folderId);</div></div><div>        }</div><div><br></div>
<br><div class="gmail_quote">
On Fri, Jul 6, 2012 at 8:43 PM, Mona Wong <span dir="ltr"><<a href="mailto:mona@sdsc.edu" target="_blank">mona@sdsc.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
        How do I get the item's parent (directory) information in the javascript?<br>
<br>
thanks,<br>
<div>Mona<br>
<br>
<br>
On Jul 6, 2012, at 8:01 AM, Zach Mullen wrote:<br>
<br>
</div><div>> The callback only receives a list of id's for items that are selected.  You can map that id to their name from the DOM though:<br>
><br>
> if(params.items.length > 0) {<br>
>     var itemId = params.items[0];<br>
>     var itemName = $('#browseTable tr[type="item"][element="'+itemId+'"] td:first span').html();<br>
>     console.log(itemName);<br>
>     ...<br>
> }<br>
><br>
><br>
> In the javascript code you can print the contents of a variable recursively to the console by using:<br>
><br>
> console.log(variable);<br>
><br>
> This works really well on Chrome, and I'm pretty sure also on Firefox. It's my preferred method of debugging :)<br>
><br>
> Thanks,<br>
><br>
> Zach<br>
<br>
</div><div>*********************************************<br>
    Mona Wong<br>
    Web & iPad Application Developer<br>
    San Diego Supercomputer Center<br>
<br>
</div>    "Forgive everyone everything."<br>
                                -- Regina Brett<br>
<div><div>*********************************************<br>
<br>
<br>
<br>
<br>
_______________________________________________<br>
Midas mailing list<br>
<a href="mailto:Midas@public.kitware.com" target="_blank">Midas@public.kitware.com</a><br>
<a href="http://public.kitware.com/cgi-bin/mailman/listinfo/midas" target="_blank">http://public.kitware.com/cgi-bin/mailman/listinfo/midas</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Thanks,<br>Michael Grauer<br>R & D Engineer<br>Kitware, Inc.<br><a href="tel:919%20969%206990%20x322" value="+19199696990" target="_blank">919 969 6990 x322</a><br>

<br><br><br>
</div>