How do you set #items in a multiple select list?

How do you set #items in a multiple select list?

rmeetinrmeetin Posts: 100Questions: 24Answers: 1

Description of problem:

I have a multiple select list. It defaults to display 4 items before scrolling. How do I change it to display a custom value?

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,443Questions: 26Answers: 4,974

    The select list size is not controlled by Datatables. You will need to set the appropriate select attribute to do what you want. Here is one example:
    https://www.w3schools.com/tags/att_select_size.asp

    Kevin

  • rmeetinrmeetin Posts: 100Questions: 24Answers: 1

    I use size in non-datatables forms and it works perfectly. I tried this in DT but it has no effect:

      {
        label: 'Page assignment:',
        name:  'url',
        type:  "select",
        size: "10",
        multiple: true,
        separator: ":",
        ...
    

    }

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395

    "size" is not a valid property for a DataTables select.
    Apply it to HTML as Kevin showed.

  • kthorngrenkthorngren Posts: 21,443Questions: 26Answers: 4,974
    Answer ✓

    Didn't realize you were using Editor. See if using attr works, like this:

    {
      label: 'Page assignment:',
      name:  'url',
      type:  "select",
      attr: {
        size: "10",
      },
      multiple: true,
      separator: ":",
      ...
    

    Kevin

This discussion has been closed.