[Midas] CALLBACK_CORE_RESOURCES_SELECTED

Michael Grauer michael.grauer at kitware.com
Sat Jul 7 13:21:03 EDT 2012


Here's how you can get it from the DOM (this was adapted from
common.browser.js)

        if ( params.items.length > 0 ) {
            var itemId = params.items[0];
            var itemName = $('#browseTable
tr[type="item"][element="'+itemId+'"] td:first span').html();
            console.log(itemName);
            var itemNode = $('#browseTable
tr[type="item"][element="'+itemId+'"]');
            var folder = midas.parentOf(itemNode);
            var folderId = '';
            // we are in a subfolder view and the parent is the current
folder
            if(folder) {
                folderId = folder.attr('element');
            }
            else {
                folderId = json.folder.folder_id;
            }
            console.log(folderId);
        }


On Fri, Jul 6, 2012 at 8:43 PM, Mona Wong <mona at sdsc.edu> wrote:

>
>         How do I get the item's parent (directory) information in the
> javascript?
>
> thanks,
> Mona
>
>
> On Jul 6, 2012, at 8:01 AM, Zach Mullen wrote:
>
> > 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:
> >
> > if(params.items.length > 0) {
> >     var itemId = params.items[0];
> >     var itemName = $('#browseTable tr[type="item"][element="'+itemId+'"]
> td:first span').html();
> >     console.log(itemName);
> >     ...
> > }
> >
> >
> > In the javascript code you can print the contents of a variable
> recursively to the console by using:
> >
> > console.log(variable);
> >
> > This works really well on Chrome, and I'm pretty sure also on Firefox.
> It's my preferred method of debugging :)
> >
> > Thanks,
> >
> > Zach
>
> *********************************************
>     Mona Wong
>     Web & iPad Application Developer
>     San Diego Supercomputer Center
>
>     "Forgive everyone everything."
>                                 -- Regina Brett
> *********************************************
>
>
>
>
> _______________________________________________
> Midas mailing list
> Midas at public.kitware.com
> http://public.kitware.com/cgi-bin/mailman/listinfo/midas
>



-- 
Thanks,
Michael Grauer
R & D Engineer
Kitware, Inc.
919 969 6990 x322
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/midas/attachments/20120707/062512ef/attachment-0001.html>


More information about the Midas mailing list