Files Web Part Height bront  2016-05-16 10:29
Status: Closed
 
Is it possible to set the height on the Files web part?

Many thanks,

bront

<h2>Embedded Files Web Part</h2>

<div id='fileDiv'></div>

<script type="text/javascript">
LABKEY.requiresScript("fileBrowser.js");
LABKEY.requiresScript("FileContent.js");
LABKEY.requiresScript("FileUploadField.js");
LABKEY.requiresScript("PipelineAction.js"); //required if in production mode

Ext.onReady(function() {

    var wikiWebPartRenderer = new LABKEY.WebPart({
      partName: 'Files',
      renderTo: 'fileDiv',
      partConfig: {
          'height': '1000px' // ?????
      }
    });

wikiWebPartRenderer.render();
});
</script>
 
 
Jon (LabKey DevOps) responded:  2016-05-16 18:29
Hi Bront,

Have you considered to size the div information via CSS?

For example:

<h2>Embedded Files Web Part</h2>

<div id='fileDiv'></div>
<style>
#fileDiv {
    height:1000px;
}
</style>

<script type="text/javascript">
LABKEY.requiresScript("fileBrowser.js");
LABKEY.requiresScript("FileContent.js");
LABKEY.requiresScript("FileUploadField.js");
LABKEY.requiresScript("PipelineAction.js"); //required if in production mode

Ext.onReady(function() {

    var wikiWebPartRenderer = new LABKEY.WebPart({
      partName: 'Files',
      renderTo: 'fileDiv'
    });

wikiWebPartRenderer.render();
});
</script>
 
bront responded:  2016-05-17 05:30
hi,

I did give that a shot yesterday before I wrote to the forum. The additional CSS rule changes the size of the surrounding wiki frame, but the files component remains the same height.

This seems possible because the file component stretches out to the full view on the Files tab. I have tried to explore how that is instantiated, but no luck as of yet.

Thanks for your help.

bront
 
Jon (LabKey DevOps) responded:  2016-05-17 12:29
Hi Bront,

So were you trying to hardcode the webpart so it only renders to a specific size rather than letting it stay dynamic?

Regards,

Jon
 
bront responded:  2016-05-23 10:59
Jon,

Either way would work. The user just requested that the Files web part display more files.

thanks,

bront
 
Jon (LabKey DevOps) responded:  2016-05-24 15:27
Hi Bront,

Thanks for confirming. So there are two ways to handle this. You can either:

A. Go into the UI and select the little triangle next to the title "Files" on that Files Web Part, select Customize, then change the webpart size from Small to either Medium or Large.

OR

B. Edit the filesWebPart.jsp file (located under the API folder (api/src/org/labkey/api/files/view/filesWebPart.jsp) and change the default value of 350 for the bean.getHeight() to a larger value:

    ActionURL projConfig = urlProvider(AdminUrls.class).getProjectSettingsFileURL(c);
    int height = null == bean.getHeight() ? 350 : bean.getHeight();

I'd probably go with the first option to see if the built-in settings work well enough for you.

Regards,

Jon