329 Lotus blogs updated hourly. Who will post next? Home | Downloads | Events | Jobs | Twitter | Bookmarks | Pods | Blogs | Search | myPL | About 
 
Sorry, no records were found!
Latest 7 Posts
Searching multiple databases in Xpages and realtime sortable results.
Sat, Aug 13th 2011 125
Xpages and Java tip:- how to save a Java object to a Notesdocument
Fri, Aug 5th 2011 111
Xpages : Here is how to create a clearable textbox!
Tue, Jun 28th 2011 1373
Xpages Debug Custom Control v2.0 released on OpenNTF
Sun, Jun 26th 2011 112
Tip: a quicker way to document your Xpage custom controls
Wed, Jun 15th 2011 78
OpenNTF We4IT Contest - Xpages Captcha Custom Control
Wed, May 18th 2011 73
Source Sniffer v3.0 - released on OpenNTF soon...
Thu, May 5th 2011 62
Top 10


Xpages : Redesign the filedownload component
Ferry Kranenburg    

For my latest xpages project, one of the requirements was to display the filedownload component differently.
By default the component shows the headers of all enabled columns, like the filetype of filesize.
One of the requirements was to remove the headers. By using CSS only I wasn't able to completely remove those headers. I also needed to get rid of all the borders.
Next requirement was to display the filetype icon BUT NOT the filetype text! Here is how it could be done. 

I was finally able to do this by using the hidden gem 'columnClasses'. With this you can specify a comma seperated list of CSS classes per column. So I added some extra classes to my CSS and there you go!

Add this to you CSS:

.xspDataTableFileDownload{

border-collapse:none;

}

.xspDataTableFileDownload TBODY TR TD{

border:none;

padding-right:0px;

}

.xspDataTableFileDownload THEAD{

display:none;

}

 

.fdownload_typeClass{

width:0px;

}

.fdownload_typeClass .xspTextComputedField{

display:none;

padding-right:0px;

}

.fdownload_fileClass{

}

.fdownload_sizeClass{

color:#D3056E;

}

 

Use this for your filedownload component code

<xp:fileDownload rows="30" id="fileDownload1"

displayLastModified="false" displayType="true" allowDelete="false"

hideWhen="true" value="#{dominoDocument1.pru_UploadFile1}"

createdTitle="upload datum" sizeTitle="grootte"

displayCreated="false" displaySize="false"

style="width:450.0px;text-align:left;font-size:9pt;" disabled="false"

columnClasses="fdownload_typeClass,fdownload_fileClass,fdownload_sizeClass,"

var="rowFile" indexVar="rowIndex">

<xp:this.fileNameValue><![CDATA[#{javascript:var aSizes:Array = ['bytes', 'kb', 'MB', 'GB', 'TB', 'PB'];

var calcnr:Number = Math.floor(Math.log(rowFile.getLength())/Math.log(1024));

var fSize = (rowFile.getLength()/Math.pow(1024, Math.floor(calcnr))).toFixed(2)+" "+aSizes[calcnr];

rowFile.getName() + " (" + fSize + ")"}]]>

</xp:this.fileNameValue>

</xp:fileDownload>

 


As you can see in the code I have hidden the column filesize by specifying 'displaySize' to false. When specifing a 'var' to the component (just like the repeat control) you can get a handle to the current file row. This way you can get the current filesize and display it in the filename column. I used the fileNameValue property to 'generate' my own file title and added the filesize to the title itself.


It took me quite a while to figure this one out, so for all developers not using the oneUI themes, here you go.

 

Click on the screenshot below how it looks.

image  


---------------------
http://www.bleedyellow.com/blogs/ferrykranenburg/entry/xpages_redesign_the_filedownload_component1
Jan 05, 2011
193 hits



Sorry, no records were found!
Recent Blog Posts




Created and Maintained by Yancy Lent - About - Blog Submission - Suggestions - Change Log - Blog Widget - Advertising - Mobile Edition