Problem changing to R view from LABKEY.QueryWebPart

LabKey Support Forum (Inactive)
Problem changing to R view from LABKEY.QueryWebPart Jon (LabKey DevOps)  2015-11-13 14:25
Status: Closed
 
Hi Will,

For the R-View to render, it needs to be utilized in a WebPart rather than a QueryWebPart.

Take a look at my example here. I used the default Importable Study we provide on LabKey.org and ran it locally:

<div id='RunsDiv'/>

<script type="text/javascript">

Ext4.onReady(function() {
    var qwp1 = new LABKEY.WebPart({
    partName: 'Report',
        renderTo: 'RunsDiv',
    containerPath: '/home/Importable Study',
        partConfig: {
        reportId: 'db:26',
        showSection: 'labkeyl'
        }
    });
qwp1.render();
});
</script>

The R view in question is coming from the Lab Results table in my study schema. If I access that R report directly, I can see the ID number of that report ID via my URL:

http://localhost:8080/labkey/study/home/Importable%20Study/dataset.view?datasetId=5007&Dataset.reportId=db%3A26

And if I go to the Source Tab of my R view, I can see the image being called is labkeyl due to the filename being indicated as: png(filename="${imgout:labkeyl}", width = 650, height = 480);

Note: It's optional for me to provide the containerPath or the showSection. Also, I could have written the same code above using jQuery like:

<p> ${labkey.webPart(partName='Report', showFrame='true', reportId = '26', showSection='labkeyl')} </p>

Configure the above code a try and see how that works out for you.

Regards,

Jon



References:

https://www.labkey.org/download/clientapi_docs/javascript-api/symbols/LABKEY.WebPart.html
https://www.labkey.org/wiki/home/Documentation/page.view?name=wikiInsertExamples