|
DbNetFile Client API Reference |
Top Previous Next |
|
The simplest file control can be created by specifying just the rootFolder property The rootFolder property specifies the name of the top level folder from which the user can navigate. The rootFolder can be specified either as a virtual or physical path. When specifying a virtual path the placeholder "~" (tilde) can be used in the path and will be substituted with the Application path at run-time
<script>
jQuery(document).ready( init )
function init()
{
var dbnetfile1 = new DbNetFile("dbnetfile1");
with (dbnetfile1)
{
rootFolder = "~/samples/dbnetfile/files/images/BeeEaters"
rootFolderAlias = "Bee-Eater Pictures"
initialize()
}
}
</script>
The rootFolderAlias property allows you to specify a user friendly display name for the rootFolder. Controls the ability to delete folders when the deleteRow toolbar property is enabled if set to true the folder in the first row will be automatically selected after the rows have loaded. This property specifies the mechanism that DbNetFile uses to browse the available folders and files. You can choose from FileSystem, IndexingService or WindowsSearch. Indexing Service and Windows Search allow additional file attributes to be displayed and searched on. Indexing Service requires that Indexing Service is running on the server. Windows Search is pre-installed on Vista, Windows 7 and Windows Server 2008 or can be downloaded from the Microsoft web site for earlier O/S versions.
<script>
jQuery(document).ready( init )
function init()
{
var dbnetfile1 = new DbNetFile("dbnetfile1");
with (dbnetfile1)
{
rootFolder = "~/samples/dbnetfile/files/images/BeeEaters"
rootFolderAlias = "Bee-Eater Pictures"
browseMode = "WindowsSearch"
initialize()
}
}
</script>
This property will cause DbNetFile to create the specified rootFolder if it does not exist.
<script>
jQuery(document).ready( init )
var today = jQuery.datepicker.formatDate('yy-mm-dd', new Date())
function init()
{
var dbnetfile1 = new DbNetFile("dbnetfile1");
with (dbnetfile1)
{
rootFolder = "~/samples/dbnetfile/" + today;
rootFolderAlias = "Today (" + today + ")";
createFolder = true;
uploadFileTypes = "gif,jpeg,png,jpg"
upload = true;
initialize()
}
}
</script>
The customMimeTypes object allows you to specify custom MIME types for particular file extensions. For example if you wanted to present CSS files as plain text then you can create a MIME type of "text/plain" for the file extension CSS.
<script>
jQuery(document).ready( init )
function init()
{
var dbnetfile1 = new DbNetFile("dbnetfile1");
with (dbnetfile1)
{
rootFolder = "~/css"
customMimeTypes = {css : "text/plain"}
initialize()
}
}
</script>
Sets the display style to either Grid or Tree. The default is Grid
<script>
jQuery(document).ready( init )
function init()
{
var dbnetfile1 = new DbNetFile("dbnetfile1");
with (dbnetfile1)
{
displayStyle = "Tree";
initialize()
}
}
</script>
displayWindowFeatures (string) Sets the features for the window used to display the document when the fileSelectionAction is set to Display
<script>
jQuery(document).ready( init )
function init()
{
var dbnetfile1 = new DbNetFile("dbnetfile1");
with (dbnetfile1)
{
fileSelectionAction = "Display";
displayWindowFeatures = "top=100,left=100,toolbar=no,resizable=yes,scrollbars=yes,status=no,height=400,width=800";
initialize()
}
}
</script>
fileInfoList (array of fileInfo objects) This property is loaded after a page is loaded and is an array populated with fileInfo objects. Each element in the array corresponds to a row in the displayed control. Sets the default display action for a selected file to either Download (document is downloaded), Preview (document is displayed in Preview dialog), Display (document is displayed in a new browser window) or None (no action)
<script>
jQuery(document).ready( init )
/////////////////////////////////////////////////////////
function init()
/////////////////////////////////////////////////////////
{
var dbnetfile1 = new DbNetFile("dbnetfile1");
with (dbnetfile1)
{
fileSelectionAction = "None"
bind("onBeforeFileSelected",setFileSelectionAction);
rootFolder="~/samples/dbnetfile/files"
initialize()
}
}
/////////////////////////////////////////////////////////
function setFileSelectionAction( fileControl, cancelArgs)
/////////////////////////////////////////////////////////
{
var filePath = fileControl.selectedFilePath
fileControl.fileSelectionAction = 'None';
switch( filePath.split('.')[filePath.split('.').length-1].toLowerCase() )
{
case 'zip':
fileControl.fileSelectionAction = 'Download';
break;
case 'jpg':
case 'png':
case 'gif':
fileControl.fileSelectionAction = 'Preview';
break;
case 'doc':
case 'xls':
case 'pdf':
fileControl.displayWindowProperties = "width=900px,height=400px;";
fileControl.fileSelectionAction = 'Display';
break;
default:
fileControl.showMessage(" This file type cannot be selected".replace(/ /g," "));
break;
}
}
</script>
Specifies the location of the element that displays the current folder path information. Value can be Top, Bottom or Hidden Controls the appearance of the Heading row Specifies the height of the control indexingServiceCatalog (string) Specifies the name of the IndexingServiceCatalog. Only used if the BrowseMode or SearchMode is set to IndexingService This property sets the maximum number of files that will be matched when searching for files. The default is 100.
<script>
jQuery(document).ready( init )
function init()
{
var dbnetfile1 = new DbNetFile("dbnetfile1");
with (dbnetfile1)
{
maxSearchMatches = 20
initialize()
}
}
</script>
Specifies the column by which the files should be initially sorted
<script>
jQuery(document).ready( init )
function init()
{
var dbnetfile1 = new DbNetFile("dbnetfile1");
with (dbnetfile1)
{
deleteRow = true
rootFolder = "~/samples/dbnetfile/files/images"
setColumnTypes("Icon","Name","DateCreated");
orderBy = "DateCreated desc"
initialize()
}
}
</script>
Specifies the number of rows displayed per page Specifies the initial height of the document preview dialog in pixels Specifies the initial width of the document preview dialog in pixels Reference to the File Search dialog. This property specifies the mechanism that DbNetFile uses to search the available folders and files. You can choose from FileSystem, IndexingService or WindowsSearch. Specifies a comma separated list of file extensions that are selectable. Any files whose extensions are not in the list are displayed but cannot be selected.
<script>
jQuery(document).ready( init )
function init()
{
var dbnetfile1 = new DbNetFile("dbnetfile1");
with (dbnetfile1)
{
deleteRow = true
rootFolder = "~/samples/dbnetfile/files/images"
setColumnTypes("Icon","Name","DateCreated");
selectableFileTypes = "gif,jpg"
initialize()
}
}
</script>
Limits selected records to files only, folders only or both. Value can be Files, Folders or FoldersAndFiles (default) Specifies the height of the image thumbnail in pixels. The width of the thumbnail is automatically set to keep the image in proportion. Specifies the size of the image thumbnail as a percentage of the original. Specifies the width of the image thumbnail in pixels. The height of the thumbnail is automatically set to keep the image in proportion. Specifies the location of the toolbar. Value can be Top, Bottom or Hidden A comma separated list of file extensions that can be uploaded.
<script>
jQuery(document).ready( init )
function init()
{
var dbnetfile1 = new DbNetFile("dbnetfile1");
with (dbnetfile1)
{
rootFolder = "~/samples/dbnetfile/files/images"
upload = true
uploadOverwrite = true
uploadFileTypes = "jpg, png, bmp, gif, doc, docx, txt"
uploadMaxFileSizeKb = 200
initialize()
}
}
</script>
A comma separated list of file extensions that can be uploaded. The maximum size in kilobytes of files that can be uploaded. Specifies a comma separated list of file extensions that are visible. Any files whose extensions are not in the list are not displayed. Specifies the width of the control windowsSearchConnectionString (string) Specifies the connection string used to connect to Windows Search engine.
The following properties control the buttons and information displayed in the toolbar Controls the appearance of the button to delete the selected file or folder Controls the appearance of the button to create a new folder. Controls the appearance of the button to open the search dialog Controls the appearance of the button to open the file upload dialog |