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:<div><br></div><div>if(params.items.length > 0) {</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> ...</div><div>}</div><div><br></div>
<div><br></div><div>In the javascript code you can print the contents of a variable recursively to the console by using:</div><div><br></div><div>console.log(variable);</div><div><br></div><div>This works really well on Chrome, and I'm pretty sure also on Firefox. It's my preferred method of debugging :)</div>
<div><br></div><div>Thanks,</div><div><br></div><div>Zach</div><div><br><div class="gmail_quote">On Thu, Jul 5, 2012 at 8:11 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>
I finally got the following to work showing a new entry for checkbox'ed item for Midas 3.2.6:<br>
<br>
$(document).ready(function()<br>
{ midas.registerCallback ( 'CALLBACK_CORE_RESOURCES_SELECTED', 'annio', function ( params )<br>
{<br>
if ( params.items.length > 0 )<br>
{<br>
var webroot = json.global.webroot;<br>
var html = '<li><img alt="" src="' + webroot +<br>
'/core/public/images/icons/edit.png"/> <a href="'<br>
+ webroot + '/midas/annio/?itemid=' +<br>
params.items.join ( ',' ) + '">Annotate image</a></li>';<br>
<br>
params.selectedActionsList.append ( html );<br>
}<br>
});<br>
});<br>
<br>
How do I get the item's name (filename) from the params?<br>
<br>
I tried params.items[0].name but that didn't work...<br>
<br>
thanks,<br>
Mona<br>
<br>
*********************************************<br>
Mona Wong<br>
Web & iPad Application Developer<br>
San Diego Supercomputer Center<br>
<br>
You are the light you wish to see.<br>
*********************************************<br>
<br>
<br>
<br>
_______________________________________________<br>
Midas mailing list<br>
<a href="mailto:Midas@public.kitware.com">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>
</blockquote></div><br><br clear="all"><div><br></div>
</div>