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

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

rmeetinrmeetin Posts: 53Questions: 12Answers: 0

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: 9,783Questions: 25Answers: 2,257

    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: 53Questions: 12Answers: 0

    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: 2,653Questions: 21Answers: 302

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

  • kthorngrenkthorngren Posts: 9,783Questions: 25Answers: 2,257
    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

Sign In or Register to comment.