Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82313

Question about using 'select2' field plugin

$
0
0

Hi,

I am trying to use 'select2' field plugin to achieve 'multi-select' dropdown box. I have the following sample JSON data:

"data": [
    {
      "DT_RowId": "row_1",
     MonthlyCost: 1000,
     MonthlyImpressions: 10000,
     Zone: [{
           Id: 1,
           name: "Zone1"
          },
         {
           id: 2,
          name: "Zone2"
          }
        ]
    },
    {
      "DT_RowId": "row_2",
      MonthlyCost: 100,
     MonthlyImpressions: 100,
     Zone: [{
           Id: 1,
           name: "Zone1"
          },
         {
           id: 2,
          name: "Zone2"
          },
          {
           id: 3,
           name: "Zone3"
          }
        ]
     
    }
]

I am trying to list zone using 'select2' field type with multi-select option. The following code does not work.

        {
            label: "DMA/Zone: ",
            name: "Zone[].id",
            "type": "select2",
            "opts": {
                "multiple": "multiple",
                "allowClear": true,
            },
        }

In addition, I may need to display zones in groups. I know you mentioned using 'children' properties. Can you give me an example? In this case, for example, I need to group 'zone1' and 'zone2' together. How do I do that?

Thank you very much for your help!

Jerry


Viewing all articles
Browse latest Browse all 82313

Trending Articles