How can one interact with a QueryWebPart via JS ?

LabKey Support Forum (Inactive)
How can one interact with a QueryWebPart via JS ? trent  2014-08-22 00:33
Status: Closed
 
Hi Leo,

I normally get the DataRegion with the getDataRegion function that belongs to the QWP (though isn't on the API docs).

var wp = new LABKEY.QueryWebPart({..});
var dataReg = wp.getDataRegion();

then e.g. current filters

    var filters = dataReg.getUserFilterArray();
    Ext4.each(filters,function(filter){
        var col = filter.getColumnName();
        var type = filter.getFilterType().getDisplayText();
        var val = filter.getValue();
        
        console.log('Filtering ' + col + ' with condition:' + type + ' ' + val);
        
    });

Though, playing around. This doesn't appear to return filters when the data has been filtered with view, customize view UI. And neither is sort info return with dataReg.getUserSort()

I discovered you can fetch the sort info with the qwp object: wp.userSort. Which returns a comma separated string of all the columns you are sorting by. But again, not when using the customise view UI - I'm not sure how to get that info..

Anyway, not sure if that helps any.