Constructors
| Name | Type | Description |
|---|---|---|
rootItem |
TreeItem |
The root item of the tree. See Script Extensions API for details |
viewId |
string |
optional
The viewId of the gadget object (The viewId specifies the destination in the DOM. This destination must exist otherwise the gadget is not rendered.) |
Example
var gadgetScriptTree, item,
rootItem = new otris.TreeItem(1, "Root item");
item = new otris.TreeItem(2, "First node");
rootItem.addItem(item);
item = new otris.TreeItem(3, "Second node");
rootItem.addItem(item);
gadgetScriptTree = new otris.gadget.gui.ScriptTree(rootItem);
Extends
Methods
-
inherited addClientFunction(clientFunction)
-
Adds a JavaScript Function to this Transferable Object. When the Object is transfered to the client the functions added to this Object will be available on the client side.
Name Type Description clientFunctionfunction The function to be added to the clientFunctions of this Object. (Can be a JavaScript Function or an Object returned by otris.gadget.util.FunctionUtils.getFunctionObject)
-
inherited addContainerButton(buttonConfig){object}
-
Adds a container button.
If the gadget is displayed in a dialog the container buttons are rendered as dialog buttons (bottom right corner of the dialog).
Otherwise the container buttons are ignoredName Type Description buttonConfigobject button config object
Name Type Default Description idstring button id
labelstring button label
clickFunctionstring name of the client function to execute on click
disabledboolean false optional - Since:
- Documents 5.0e
Returns:
Type Description object buttonConfig Example
// Alternative gadget action button gadgetForm.addContainerButton({ id: "myCustomSaveButton", label: "Speichern", clickFunction: "saveGadgetData" }); gadgetForm.addClientFunction(function saveGadgetData(event) { var gForm = documentsContext.getGadgetContext().getClientObject(); gForm.submitForm({ gadgetAction: "processForm" }, { showBusyPanel: true }); }); -
addDialogAction(id, label, dialogActionCallback)
-
Add a dialog action. The action are displayed as buttons if the tree is rendered in a dialog.
The callbackFunction must have the following signature: function(selectedIds, documentsContext) {}Name Type Description idstring id for the action.
labelstring The label for the button
dialogActionCallbackfunction The function that is executed if the button is clicked.
dialogActionCallback(selectedIds, documentsContext)
Dialog action function
Name Type Description selectedIdsArray.<string> The date as string of the clicked item
documentsContextdocuments.sdk.DocumentsContext The DocumentsContext instance
Example
gadgetScriptTree.addDialogAction("apply", "Übernehmen", function(selectedIds, documentsContext) { console.log("APPLY", selectedIds, documentsContext); documentsContext.closeGadget(); }); -
inherited addPdfButton(config)
-
Adds a button to download the displayed gadget as pdf. The button will show on hover in the left top corner of the gadget.
Name Type Description configobject optional config object
Name Type Default Description filenamestring content.pdf optional filename of the pdf for download
buttonStylestring left: 200px; optional style for the pdf button to be applied to
- Since:
- Documents 5.0d
Example
myGadget.addPdfButton({filename: "myCustomFilename.pdf", buttonStyle: "left: 200px; }); -
inherited addSettings(option)
-
Adds a setting (an option that can be defined by the user) to the gadget.
Name Type Description optionGadgetSetting | Array.<GadgetSetting> the setting(s) to add to the gadget.
- Since:
- Documents 5.0a
-
inherited onGadgetLoad(onloadHandler)
-
Sets an onLoad handler for the Gadget. The handler is executed when the gadget is displayed at the client.
Name Type Description onloadHandlerfunction | string the handler to be executed (must be either a javascript function or a string representing a function)
-
inherited setContainerButtons(containerButtonConfigs)
-
Set the container buttons.
Please note that existing default buttons are removed by this operation.Name Type Description containerButtonConfigsArray.<object> array of button config objects
Name Type Default Description idstring button id
labelstring button label
clickFunctionstring name of the client function to execute on click
disabledboolean false optional - Since:
- Documents 5.0e
-
inherited setContextData(contextData)
-
Set additional data which is serialized with
JSON.stringify()and then transferred to the client
On the client side the the context data is accessible with theGadgetContextName Type Description contextDataany the context data
- Since:
- Documents 5.0c
Example
var htmlGadget = new otris.gadget.gui.HTML("<h1>Only a simple example</h1>"); var myGadgetData = { mySpecialId: 44137, myIndexArray: [1,7,6,3,2], myTitle: "A special GadgetTitle" }; htmlGadget.setContextData(myGadgetData); -
inherited setNavibarEntry(gadgetConfig, label)
-
Add a navibar entry. Define a gadgetConfig that reloads the gadget.
Only works if the gadget ist displayed in main list view area.Name Type Description gadgetConfigobject gadgetConfig
labelstring optional label for the navibar entry (defaults to the gadget title)
- Since:
- Documents 5.0e
-
setOnClick(onClickFunction)
-
Set the onclick function for the tree nodes. The function must have the following signature:
function(node, selectedIds, documentsContext) {}Name Type Description onClickFunctionfunction Function with the following signature: function(node, selectedIds, documentsContext) {}
Example
gadgetScriptTree.setOnClick(function(node, selectedIds, documentsContext) { console.log("CLICK", node, selectedIds, documentsContext); }); -
setOnDoubleClick(onClickFunction)
-
Set the onDoubleClick function for the tree nodes. The function must have the following signature:
function(node, selectedIds, documentsContext) {}Name Type Description onClickFunctionfunction Function with the following signature: function(node, selectedIds, documentsContext) {}
Example
gadgetScriptTree.setOnDoubleClick(function(node, selectedIds, documentsContext) { console.log("DOUBLE CLICK", node, selectedIds, documentsContext); }); -
setOpenTreeLevel(openTreeLevel)
-
Defines to which level the tree is opened by default
Name Type Description openTreeLevelnumber tree level
-
setRenderRootNode(renderRootNode)
-
If set to false the root node is not rendered. Defaults to true
Name Type Default Description renderRootNodeboolean true optional Render the root node?
-
setRootItem(rootItem)
-
Set the root item of the tree
Name Type Description rootItemTreeItem The root item of the tree. See Script Extensions API for details
-
inherited setStyle(name, value)
-
Sets a style attribute of the html container
Name Type Description namestring the name of the style parameter (i.e. "height")
valuestring the value of the style parameter (i.e. "100px")
-
inherited setTitle(title)
-
Sets the Title of the Form
Name Type Description titlestring the title of the form (will be displayed as the window header on dashboards)
-
setUseTreeSearch(useTreeSearch)
-
Enables a search field for the tree. Defaults to false
Name Type Default Description useTreeSearchboolean false optional Display a search field?
-
inherited store(key, value)
-
Stores data that can later be accessed on client side.
ATTENTION: The store used in this method is global.
UsesetContextDatato store data for this gadget instance.Name Type Description keystring the key to store the data
valueany the value, or object that should be stored
-
transfer()
-
Make this object ready for beeing transferred to the client