copies a selected file/folder
fmanager.copyFile(source,target);
params:
creates a new folder
fmanager.createFolder(targetId);
params:
deletes items by their ids
fmanager.deleteFile(ids);
params:
downloads a selected file
fmanager.download(id);
opens editor for a certain item in the active view (Tree or Files view)
fmanager.editFile(id);
params:
gets ids of active items
var ids = fmanager.getActive();
returns:
gets the reference to the active view (Tree or Files view)
var view = fmanager.getActiveView();
returns:
gets the popup menu object
var menu = fmanager.getMenu();
returns:
gets an array of folders' ids in a path
var pathIds = fmanager.getPath();
// or
var pathIds = fmanager.getPath(id);
params:
returns:
gets an array of folders' names in a path
var pathNames = fmanager.getPathNames();
// or
var pathNames = fmanager.getPathNames(id);
params:
returns:
gets an array of items (files, folders) that contains text in their names
var result = fmanager.getSearchData(id,text);
params:
returns:
gets the uploader object
var uploader = fmanager.getUploader();
returns:
goes back in the navigation history
fmanager.goBack(step);
params:
goes forward in the navigation history
fmanager.goForward(step);
params:
hides search results
fmanager.hideSearchResults();
selects the parent folder
fmanager.levelUp(id);
preselectes files/folders for copy operation
fmanager.markCopy(id);
preselectes files/folders for move operation
fmanager.markCut(id);
moves a selected file/folder
fmanager.moveFile(source,target);
params:
pastes files/folders that were selected for copying or moving
fmanager.pasteFile(id)
params:
renames a folder/file
fmanager.renameFile(id,name,property);
params:
selects a certain folder and sets path values for it
fmanager.setPath(id);
params:
searches text and displays results on the screen
fmanager.showSearchResults(text);
params:
opens a file upload dialog
fmanager.uploadFile(target);
specifies the collection of server scripts for action handling
webix.ui({
view:"filemanager",
handlers:{
"upload" : "data/saving.php",
"download" : "data/saving.php",
...
}
});
defines icons for File Manager
webix.ui({
view:"filemanager",
id:"files",
icons: {
folder: "folder",
doc: "file-word-o",
...
}
});
defines the id of the initially selected mode ("table" by default)
webix.ui({
view:"filemanager",
id:"files",
mode: "files"
...
});
specifies an array of modes in the File view
webix.ui({
view:"filemanager",
id:"files",
modes: ["files","table"]
...
});
sets readonly mode for File Manager
webix.ready(function(){
webix.ui({
view:"filemanager",
readonly: true,
url:"../common/data.php"
});
});
sets the configuration of File Manager views
webix.ui({
view:"filemanager",
id:"files",
structure:{
...
}
...
});
Related sample: Adding New Mode
defines a template for a newly created folder
templateCreate: function(){
return {value: "newFolder", type: "folder", date: new Date()};
}
defines a template applied for the format of folder/file's date of modification
webix.ui({
view:"filemanager",
templateDate: function(obj){
var date = obj.date;
if(typeof(date) != "object"){
date = new Date(parseInt(obj.date,10)*1000);
}
return webix.i18n.fullDateFormatStr(date);
}
});
defines a template for icons that can be customized (used in "files" and "table" views)
templateIcon: function(obj,common){
return "<span class='webix_icon webix_fmanager_icon fa-"
+(common.icons[obj.type]||common.icons["file"])+"'></span>";
},
defines a template applied for the folder/file's name
templateName: function(fileObj,common){
return fileObj.value
}
defines a template applied for the file size
templateSize: function(obj,common){
var value = obj.size;
var isInt = (parseInt(value,10) == value);
// apply locale formating
var getFormatedValue = webix.Number.numToStr({
decimalDelimiter:webix.i18n.decimalDelimiter,
groupDelimiter:webix.i18n.groupDelimiter,
decimalSize : isInt?0:webix.i18n.groupSize
});
value = getFormatedValue(value);
// get size label
var labels = webix.i18n.filemanager.sizeLabels; // ["B","KB",...]
var sizeIndex = 0;
while(value/1024 >1){
value = value/1024;
sizeIndex++;
}
var label = labels[sizeIndex];
return value+""+label;
},
defines an object with configuration of progress bar that appears during the upload
webix.ui({
view:"filemanager",
id:"files",
uploadProgress: {
type:"top",
delay:3000,
hide:true
}
});
Back to top