QueryWebPart deprecated?

LabKey Support Forum (Inactive)
QueryWebPart deprecated? trent  2016-03-17 19:46
Status: Closed
 
Hi,

I've just been asked to upgrade our instance of LabKey. We were on 14.1 so quite a few versions out of date. Just resolving a couple of issues with some (file-based) modules.

I note that LABKEY.QueryWebPart no longer resolves? Upon looking at the API docs - it is still listed. https://www.labkey.org/download/clientapi_docs/javascript-api/symbols/LABKEY.QueryWebPart.html.

Playing around on the console I see QueryWebPart2 appears (which isn't in the API docs) - is this favoured now?

I glanced over the release notes between 14.1 and 16.1 to see if anything was mentioned, but couldn't see anything (possible overlooked though).

Cheers,
 
 
Jon (LabKey DevOps) responded:  2016-03-17 19:53
Hi Trent,

LABKEY.QueryWebPart still works and is not deprecated

Does some of your code match up to what we have here?

https://www.labkey.org/wiki/home/Documentation/page.view?name=include

Regards,

Jon
 
trent responded:  2016-03-17 20:11
Hi Jon,

Thanks for the link.

This is what I have/had on my page:

visitsWebPart = new LABKEY.QueryWebPart({
            schemaName : 'offsite_repository',
            queryName: 'patient_visit'
            renderTo: renderElement,
            showRecordSelectors: true,
            frame: 'none',
            buttonBar: {//add custom buttons
            }
});

Looking at your page you linked to, I see the Files browser needs some extra libraries loaded. Do I need to do that to access the QueryWebPart now?

..

Ok, looking deeper into the page you linked, I found the following:

${labkey.webPart(partName='Query', showFrame='true', title = 'Module Inventory', schemaName ='core', queryName ='Modules', buttonBarPosition ='top', allowChooseQuery ='true', allowChooseView = 'true')}

Is there a way I can still use LABKEY.QueryWebPart (in JavaScript) rather that the above syntax?
I integrate custom buttons like so, in the existing code:

buttonBar: {
    includeStandardButtons: false,
    items: [
        {
            text: 'Row Actions',
            requiresSelection: true,
            items: customButtons
        },

        LABKEY.QueryWebPart.standardButtons.views,

        LABKEY.QueryWebPart.standardButtons.exportRows,
        LABKEY.QueryWebPart.standardButtons.print,
        LABKEY.QueryWebPart.standardButtons.pageSize
    ]

}

Cheers,
Trent
 
trent responded:  2016-03-17 20:59
Ok.. after getting it working with the syntax:

${labkey.webPart(partName='Query', showFrame='true', title = 'Module Inventory', schemaName ='core', queryName ='Modules', buttonBarPosition ='top', allowChooseQuery ='true', allowChooseView = 'true')}

and searching `QueryWebPart` in the developer console, i find that ext3.min.js is loaded. I find this works:

<script type="text/javascript">
LABKEY.requiresExt3ClientAPI(function(){

Ext4.onReady(function(){

var vialsWebPart = new LABKEY.QueryWebPart({
            schemaName : 'offsite_repository',
            queryName: 'patient_visit',
            renderTo: 'qwpReg',
            showRecordSelectors: true,
            frame: 'none'});

console.log(LABKEY.QueryWebPart);
});

});

</script>
<div id="qwpReg"></div>

Not sure if there is a better approach....
 
Jon (LabKey DevOps) responded:  2016-03-18 07:29
Hi Trent,

So there was a significant change between 14.1 and 16.1, sometime around 15.2 where if you didn't enable the respective "Require ExtJS v3.4.1 to be loaded on each page" and the "Require ExtJS v3.x based Client API be loaded on each page" options within the Site Settings of the Admin Console, you would have to insert in a helper like LABKEY.requiresExtClientAPI.

So if you enable those checkboxes in Site Settings, you will not need to use those dependencies within the code itself.

Site Settings under Admin Console - https://www.labkey.org/wiki/home/Documentation/page.view?name=configAdmin
Declaring Script Dependencies - https://www.labkey.org/wiki/home/Documentation/page.view?name=scriptdepend
Namespace for LABKEY (with all the existing dependencies you can call) - https://www.labkey.org/download/clientapi_docs/javascript-api/symbols/LABKEY.html

Regards,

Jon