MultiSelect

The MultiSelect control extends the ComboBox and adds checkboxes to each item in the drop-down list.

The control exposes the list of checked items through the checkedItems property:

Checked Items:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    // This file locates: "Scripts/Lesson/C1Input/MultiSelect.js".
    c1.documentReady(function () {
        var theMultiSelect = wijmo.Control.getControl('#theMultiSelect');
        theMultiSelect.checkedItemsChanged.addHandler(function (s, e) {
            var arr = s.checkedItems,
              html = '';
            for (var i = 0; i < arr.length; i++) {
                html += wijmo.format('<li>{Country}</li>', arr[i]);
            }
            document.getElementById('checkedItems').innerHTML = html;
        });
    });
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    using System.Web.Mvc;
     
    namespace LearnMvcClient.Controllers
    {
        public partial class C1InputController : Controller
        {
            // GET: MultiSelect
            public ActionResult MultiSelect()
            {
                return View(Models.Gdp.GetData());
            }
        }
    }
    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
    26
    27
    @model IEnumerable<Gdp>
     
    <h1>
        @Html.Raw(Resources.C1Input.MultiSelect_Title)
    </h1>
     
    <p>
        @Html.Raw(Resources.C1Input.MultiSelect_Text1)
    </p>
    <p>
        @Html.Raw(Resources.C1Input.MultiSelect_Text2)
    </p>
    <div class="row demo-settings">
        <div class="col-xs-5">
            @(Html.C1().MultiSelect<Gdp>().Id("theMultiSelect")
                .Bind(Model).Placeholder(Resources.C1Input.MultiSelect_Text3)
                .HeaderFormat("{count:n0} countries")
                .DisplayMemberPath("Country")
            )
        </div>
        <div class="col-xs-7">
            <p>
                @Html.Raw(Resources.C1Input.MultiSelect_Text4)
            </p>
            <ul id="checkedItems"></ul>
        </div>
    </div>