DbNetFile Client API Reference

Top  Previous  Next

Basic Properties

The simplest file control can be created by specifying just the rootFolder property

rootFolder (string)

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>

Run Sample

rootFolderAlias (string)

The rootFolderAlias property allows you to specify a user friendly display name for the rootFolder.

Additional Properties

allowFolderDeletion (boolean)

Controls the ability to delete folders when the deleteRow toolbar property is enabled

autoSelectFolder (boolean)

if set to true the folder in the first row will be automatically selected after the rows have loaded.

Run Sample

browseMode (string)

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>

Run Sample

createFolder (boolean)

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>

Run Sample

customMimeTypes (object)

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>

Run Sample

displayStyle (string)

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>

fileFilter (string)

Applies a filter to the files selected

	<script>
	jQuery(document).ready( init )

	function init()
	{
		var dbnetfile1 = new DbNetFile("dbnetfile1");
		with (dbnetfile1)
		{
			fileFilter = "name like '%sales%'"
			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.

fileSelectionAction (string)

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>

 

Run Sample

folderFilter (string)

Applies a filter to the files selected

	<script>
	jQuery(document).ready( init )

	function init()
	{
		var dbnetfile1 = new DbNetFile("dbnetfile1");
		with (dbnetfile1)
		{
			folderFilter = "name like 'user_%'"
			initialize()
		}
	}
	</script>

folderPathLocation (string)

Specifies the location of the element that displays the current folder path information. Value can be Top, Bottom or Hidden

Run Sample

headerRow (boolean)

Controls the appearance of the Heading row

Run Sample

height (number)

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

maxSearchMatches (number)

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>

Run Sample

orderBy (string)

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>

Run Sample

pageSize (number)

Specifies the number of rows displayed per page

Run Sample

previewDialogHeight (number)

Specifies the initial height of the document preview dialog in pixels

previewDialogWidth (number)

Specifies the initial width of the document preview dialog in pixels

searchDialog (object)

Reference to the File Search dialog.

searchMode (string)

This property specifies the mechanism that DbNetFile uses to search the available folders and files. You can choose from FileSystem, IndexingService or WindowsSearch.

selectableFileTypes (string)

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>

 

Run Sample

selectionMode (string)

Limits selected records to files only, folders only or both. Value can be Files, Folders or FoldersAndFiles (default)

Run Sample

thumbnailHeight (number)

Specifies the height of the image thumbnail in pixels. The width of the thumbnail is automatically set to keep the image in proportion.

thumbnailPercent (number)

Specifies the size of the image thumbnail as a percentage of the original.

thumbnailWidth (number)

Specifies the width of the image thumbnail in pixels. The height of the thumbnail is automatically set to keep the image in proportion.

toolbarLocation (string)

Specifies the location of the toolbar. Value can be Top, Bottom or Hidden

uploadFileTypes (string)

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>

 

Run Sample

uploadOverwrite (boolean)

A comma separated list of file extensions that can be uploaded.

uploadMaxFileSizeKb (number)

The maximum size in kilobytes of files that can be uploaded.

visibleFileTypes (string)

Specifies a comma separated list of file extensions that are visible. Any files whose extensions are not in the list are not displayed.

Run Sample

width (number)

Specifies the width of the control

windowsSearchConnectionString (string)

Specifies the connection string used to connect to Windows Search engine.

 

Toolbar Properties

The following properties control the buttons and information displayed in the toolbar

deleteRow (boolean)

Controls the appearance of the button to delete the selected file or folder

newFolder (boolean)

Controls the appearance of the button to create a new folder.

search (boolean)

Controls the appearance of the button to open the search dialog

upload (boolean)

Controls the appearance of the button to open the file upload dialog