options not set to selected in multiselect dropdownbox.

options not set to selected in multiselect dropdownbox.

Hi,

I am using a mvc webapplication for filtering some data. Therefor I have a viewmodel with the filters. I found a nice multiselect dropdownbox from Eric Hynds.

Why aren't the options set to selected for the values in the span of the button?


this is a part of the rendered html.

  1. <select name="multipleSelectDropDown878" class="filterSelectMultiSelect" id="multipleSelectDropDown878" style="display: none;" onchange="javascript: filterChange(false);"><option value="878_"></option>
    <option value="878_NSENPF5">NSENPF5</option>
    <option value="878_SBAMO2AE">SBAMO2AE</option>
    <option value="878_SBBAO3AE">SBBAO3AE</option>
    <option value="878_SBBWBADIDO">SBBWBADIDO</option>



    </select><button class="ui-multiselect ui-widget ui-state-default ui-corner-all" aria-haspopup="true" style="width: 300px;" type="button">NSENPF5, SBAMO2AE</button> </td>

  2. $(".filterSelectMultiSelect").multiselect({

    multiple: true,

    header: false,

    noneSelectedText: "(Alle)",

    selectedList: 4,

    close: function (event, ui) {

    var foo_array = [];

    GetThis(this);

    }

    });

    function GetThis(obj)

    {

    $(obj).find('button.span').each(function () {

    foo_array.push($(this).data('foo'));

    alert(foo_array);

    });

    }

Can you please help?


regards,
Ronald