Skip to content
🚀 Rapid Application Development with the App Builder

global

The global hook at the app level allows developers to write reusable functions that can be used in other hooks.

If you prefer to write JavaScript in an external file with your own editor, use the loadScript(fileName) function in the onAppOpen hook.

Parameters

None

Return Value

None

Examples

✨ Example of a custom button added using a JavaScript template

js
function myCustomAction(columnName) {
    return `<div>
        <button onclick="alert('My custom action from column ${columnName}')">My Custom Action</button>
    </div>`
}

✨ The same example using vanilla JavaScript

js
function myCustomAction(columnName) {
    const button = window.document.createElement("button")
    button.innerHTML = "My Custom Action"
    button.setAttribute("onclick", `alert("My custom action from column ${columnName}")`)
  
    return button
}

✨ The same example using jQuery

js
function myCustomAction(columnName) {
	if (window.jQuery) {
		const button = window.jQuery("<button>", {
			text: "My Custom Action",
			onclick: `alert("My custom action from column ${columnName}")`,
		})

    	return button[0]
    } else {
        return null
    }
}

Other Examples

Notes

  • Do not define a function name as a constant. Doing so will result in an error when the function body is updated.
  • See Other Examples to learn how to add event listeners.