Converting a URL-encoded filter to a LABKEY.Filter - is there a quick and easy way?

LabKey Support Forum
Converting a URL-encoded filter to a LABKEY.Filter - is there a quick and easy way? Leo Dashevskiy  2015-10-20 13:24
Status: Closed
 
We seem to have found a way around it by on the front side passing the string:

filters = Ext.encode( <QueryWebPart instance>.getDataRegion().getUserFilter() )

and on the back-end decoding it as follows:

filters <- RJSONIO::fromJSON( labkey.url.params$filters )

filter <- as.matrix( lapply( filters, function( e ){
    return( paste0( RCurl::curlEscape( e['fieldKey'] ), '~', e['op'], '=', RCurl::curlEscape( e['value'] ) ) );
}) );
if ( nrow( filter ) == 0 ){
  filter <- NULL;
}

The resulting object "filter" can then be passed directly as the value of the "colFilter" parameter of the "labkey.selectRows()" method, since it is in the exact same form as the result of a call to the "makeFilter()" method.