Skip to content

Check List

The CheckList widget in Emakin allows multiple selections from a list of checkboxes. List options can be sourced from various data sources, including static lists or query results.

Single Mode

CheckList supports storing selections in a single data model element by enabling Single Mode. In this mode, checked item values are stored as a comma-separated string.

  • Enabling Single Mode:
    Set the ItemXPath property to the ! character.

Remarks

Default Behavior

  • The CheckList widget uses a sequence-type data model to store selected items.
  • Checked Items: Each selected item creates a new element in the data model with the corresponding value.

Data Mapping

  • Value Assignment:

    • Defined by the data source item's Value property using the ValueXPath property.
    • Default: Empty string, assigning the data source item value to the new element.
  • Label Assignment:

    • Defined by the data source item's Text property using the CaptionXPath property.
    • Default: Empty string, assigning the data source item's Text property to the new element's Caption attribute.

State Attribute

The CheckList widget supports monitoring list item changes using the State attribute:

  • Temp: Marks newly checked items.
  • Existing Items: Preserved as is.
  • Deleted: Marks items that were unchecked.

Clearing the State Attribute:
Use the scripting method $Xml.CommitDeletes() to reset the State attribute.

Example

An example checklist widget that uses data sources can be defined as follows:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<CheckList RequiredForGroup="" Layout="Vertical" XPath="List">
    <ItemXPath><![CDATA[*]]></ItemXPath>
    <ValueXPath><![CDATA[Value]]></ValueXPath>
    <CaptionXPath><![CDATA[Caption]]></CaptionXPath>
    <DataSources>
        <ListItemDataSource TextFormat="{{Text}}" ValueFormat="{{Value}}" Enabled="True">
            <Mappings/>
            <Items>
                <Item>
                    <Text Type="System.String"><![CDATA[Item 1]]></Text>
                    <Value Type="System.String"><![CDATA[1]]></Value>
                </Item>
                <Item>
                    <Text Type="System.String"><![CDATA[Item 2]]></Text>
                    <Value Type="System.String"><![CDATA[2]]></Value>
                </Item>
                <Item>
                    <Text Type="System.String"><![CDATA[Item 3]]></Text>
                    <Value Type="System.String"><![CDATA[3]]></Value>
                </Item>
            </Items>
        </ListItemDataSource>
    </DataSources>
</CheckList>

Single Mode Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<CheckList RequiredForGroup="" Layout="Horizontal" XPath="SingleMode">
    <Rules/>
    <ItemXPath><![CDATA[!]]></ItemXPath>
    <ValueXPath><![CDATA[]]></ValueXPath>
    <CaptionXPath><![CDATA[]]></CaptionXPath>
    <DataSources>
        <ListItemDataSource TextFormat="{{Text}}" ValueFormat="{{Value}}" Enabled="True">
            <Mappings/>
            <Items>
                <Item>
                    <Text Type="System.String"><![CDATA[Item 1]]></Text>
                    <Value Type="System.String"><![CDATA[1]]></Value>
                </Item>
                <Item>
                    <Text Type="System.String"><![CDATA[Item 2]]></Text>
                    <Value Type="System.String"><![CDATA[2]]></Value>
                </Item>
                <Item>
                    <Text Type="System.String"><![CDATA[Item 3]]></Text>
                    <Value Type="System.String"><![CDATA[3]]></Value>
                </Item>
            </Items>
        </ListItemDataSource>
    </DataSources>
</CheckList>