templates

specifies templates for the list and grid modes and the progressBar configuration

object templates;

Example

function listTemplate(item) {     return <div>" + item.name + "</div>; }  
function progressBarTemplate(percent, extra) {     return getBasis(extra.current) + "/" + getBasis(extra.total); }  
const vault = new dhx.Vault("vault_container", {
    uploader: {
        target: "https://docs.dhtmlx.com/vault/backend/upload"
    },
    downloadURL: "https://docs.dhtmlx.com",
    templates: {         list: listTemplate,         progressBar: progressBarTemplate,     }    });
vault.data.load("https://snippet.dhtmlx.com/codebase/data/vault/01/dataset.json");

Related samples

Details

The templates property is an object that may include the following properties:

  • list - optional, template function for the list mode. It takes the following parameter:
    • item - an object of a data item
  • grid - optional, the template function for the grid mode. It takes the following parameter:
    • item - an object of a data item
  • progressBar - optional, the template function for the progressBar. Takes the following parameters:
    • percent - (number) the current percent of files uploading, a number from 0 to 100
    • extra - (object) an object with additional properties. It can have two optional properties:
      • current - (number) the size of the currently uploaded files in bytes
      • total - (number) the total size of all files in the list in bytes
See also
Change log

added in v5.0

Back to top