Include the client JavaScript & CSS libraries
<link rel="stylesheet" type="text/css" href="dbnetsuite.css.ashx" />
<script language="JavaScript" src="dbnetsuite.js.ashx"></script>
Client-side configuration script
<script>
jQuery(document).ready( init )
function init()
{
var dbnetfile1 = new DbNetFile("dbnetfile1");
with (dbnetfile1)
{
deleteRow = true
upload = true
newFolder = true
rootFolder="~/samples/dbnetfile/files/images"
displayStyle = "Tree"
visibleFileTypes = "jpg,gif,png"
uploadFileTypes = "jpg,gif,png"
bind("onCellTransform",customiseTree)
initialize()
}
var dbnetfile2 = new DbNetFile("dbnetfile2");
with (dbnetfile2)
{
deleteRow = true
navigation = false
upload = true
newFolder = true
rootFolder="~/samples/dbnetfile/files/images"
displayStyle = "Grid"
visibleFileTypes = "jpg,gif,png"
bind("onCellTransform",customiseGrid)
setColumnTypes("Name","DateCreated","Size")
setColumnProperty("Name","browseDisplay",true)
setColumnProperty("Name","label","Name")
setColumnProperty("Name","selectable",true)
setColumnProperty("DateCreated","browseDisplay",true)
setColumnProperty("DateCreated","label", "Date Created")
setColumnProperty("DateCreated","selectable",false)
setColumnProperty("Size","browseDisplay",true)
setColumnProperty("Size","label", "Size")
setColumnProperty("Size","selectable",false)
initialize()
}
}
function customiseTree(control, args)
{
if (args.fileInfo.recordType != "FileInfo")
return;
var d = jQuery.datepicker.formatDate('MM yy',args.fileInfo.dateCreated);
jQuery(args.cell).append(" <span class=uploadInfo>File uploaded " + d + "</span>")
}
function customiseGrid(control, args)
{
if (args.fileInfo.recordType != "FileInfo")
return;
if ( jQuery(args.cell).attr("columnType") == "Size")
if (args.fileInfo.size > 10000)
args.cell.style.backgroundColor = "gold";
}
</script>
HTML markup
<table>
<tr>
<td style="vertical-align:top">
<fieldset>
<legend>Tree View</legend>
<div id="dbnetfile1"></div>
</fieldset>
</td>
<td style="vertical-align:top">
<fieldset>
<legend>Grid View</legend>
<div id="dbnetfile2"></div>
</fieldset>
</td>
</tr>
</table>
CSS
<style>
.uploadInfo
{
color:silver;
font-size:x-small;
}
</style>