WebPart JavaScript API

LabKey Support Forum (Inactive)
WebPart JavaScript API slangley  2012-11-26 16:28
Status: Closed
 
Would it be possible to provide some JavaScript API functions to:

1. return the array of webparts that appear on the current page?
2. return the webpart that contains a given rendered Ext JS Component?
3. programatically change the title of a given webpart?

Thanks.

Scott
 
 
Ben Bimber responded:  2012-11-26 17:10
Hi Scott,

for #3, check out LABKEY.Utils.setWebpartTitle().

for #2, how would you anticipate using that?

for #1, if all you need to do is find the tables, you might be able to do something like:

Ext4.query('table[class=labkey-wp]');

to find all rendered webparts. the above is not tested, and you might need to tweak that query. I dont think that would automatically tell you any context about the webpart, such as the webpart type.

An Ext component query along the lines of what I suggest for #1 might also help identify webparts with a particular Ext component.

-Ben
 
slangley responded:  2012-11-27 11:03
Hi Ben,

Thanks for those suggestions. I think they will meet my needs for the moment.

Scott