Understanding Array Options and Reference Levels in Jamovi Modules
Posted: Mon Feb 02, 2026 2:13 am
Hi everyone,
I'm developing a Jamovi module and trying to understand how Array-type options work, specifically looking at the `refLevels` example from the `jmv` linear regression module:
I have several questions about this structure:
1. Array Type Options
- What is the `template` property and what types can it contain?
- Are there other template types besides `Group`?
- What control types can be used in `elements`?
2. The `items` Property
I thought this creates automatic bindings, but looking at the JavaScript code, I see explicit `setValue()` calls:
If JavaScript explicitly populates the array, what does `items: (factors)` actually do? Is it just metadata, or does it provide some automatic functionality I'm missing?
3. Special Keywords
-$key: What does `content: $key` mean? Is this a placeholder that gets replaced at runtime?
-Level: The ref element uses `type: Level` - is this a special control type for factor levels?
- Are there other "magic" keywords or special types like these that are documented somewhere?
####################
The structure looks like it should auto-populate based on the factors option (via `items`), but the JavaScript code suggests manual population is required. Which is it?
Any clarification on how these pieces fit together would be greatly appreciated!
Thanks in advance!
I'm developing a Jamovi module and trying to understand how Array-type options work, specifically looking at the `refLevels` example from the `jmv` linear regression module:
Code: Select all
- name: refLevels
title: Reference Levels
type: Array
items: (factors)
template:
type: Group
elements:
- name: var
type: Variable
content: $key
- name: ref
type: Level1. Array Type Options
- What is the `template` property and what types can it contain?
- Are there other template types besides `Group`?
- What control types can be used in `elements`?
2. The `items` Property
I thought this creates automatic bindings, but looking at the JavaScript code, I see explicit `setValue()` calls:
Code: Select all
ui.refLevels.setValue(list3);3. Special Keywords
-$key: What does `content: $key` mean? Is this a placeholder that gets replaced at runtime?
-Level: The ref element uses `type: Level` - is this a special control type for factor levels?
- Are there other "magic" keywords or special types like these that are documented somewhere?
####################
The structure looks like it should auto-populate based on the factors option (via `items`), but the JavaScript code suggests manual population is required. Which is it?
Any clarification on how these pieces fit together would be greatly appreciated!
Thanks in advance!