intercellular / cell

A self-driving web app framework

Home Page:https://www.celljs.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Select multiple and attribute order

lachdoug opened this issue · comments

Below are two objects that define forms with select/multiple fields.
myForm works: all three options render selected.
myForm2 differs from myForm in that on the select field the 'multiple' attribute is defined after the '$components' attribute. In this case only the last option renders as selected.

screenshot from 2018-05-13 22-26-06

I would have thought that the attribute order should not matter. Am I misunderstanding something? I can't find anything in the docs that suggests that $components must be defined after other attributes.

myForm = {
  $cell: true,
  $type: "form",
  $components: [
    {
      $type: "select",
      name: "select[]",
      multiple: true,
      $components: [
        {
          $type: "option",
          $text: "First option",
          selected: true
        },
        {
          $type: "option",
          $text: "Second option",
          selected: true
        },
        {
          $type: "option",
          $text: "Third option",
          selected: true
        },
      ]
    }
  ]
};
myForm2 = {
  $cell: true,
  $type: "form",
  $components: [
    {
      $type: "select",
      name: "select[]",
      $components: [
        {
          $type: "option",
          $text: "First option",
          selected: true
        },
        {
          $type: "option",
          $text: "Second option",
          selected: true
        },
        {
          $type: "option",
          $text: "Third option",
          selected: true
        },
      ],
      multiple: true
    }
  ]
};