Appearance
setColumnValue(columnName, columnValue)
Updates the value of the specified column.
Scope: FORM
Parameters
| Parameter | Type | Description |
|---|---|---|
| columnName | string | The name of the database table column. |
| columnValue | any | The new value of the specified column. |
Return Value
None
✨ Example of an onRowInit Hook
Applies a default value to column type depending on the users role.
js
((mode, getColumnValue, setColumnValue, setColumnStyle) => {
if (mode === "INSERT") {
if (app.userHasRole("admin")) {
setColumnValue("type", "admin")
} else {
setColumnValue("type", "user")
}
}
})✨ Example Updating a Column Value from a Custom Button
The required arguments (...) depend on the specific hook used.
js
((...) => {
const buttonId = 'custom-btn-' + Date.now()
setTimeout(() => {
const button = document.getElementById(buttonId)
if (button) {
button.addEventListener('click', () => {
app.setColumnValue('location', 'NEW-LOCATION')
})
}
}, 0)
return `<button id="${buttonId}">
UPDATE LOCATION
</button>`
})