Wj-multi-select items not refreshing

Posted by: vlad-tovbin on 14 September 2017, 2:51 am EST

    • Post Options:
    • Link

    Posted 14 September 2017, 2:51 am EST

    If the drop-down items of wj-multi-select are modified, the drop-down does not reflect the correct state. What is the correct technique to refresh the items ?

    <wj-multi-select items-source=“ProductCodes” checked-member-path=“Selected” …></wj-multi-select>

    Somewhere else on the page a button is clicked that invokes this function:

    $scope.testf = function () {

    angular.forEach($scope.ProductCodes, function (item) {

    item.Selected = false;

    });

    }

    The displayed state of the items in the wj-multi-select control remains unchanged.

  • Posted 14 September 2017, 2:51 am EST

    Hi Vlad,

    You just clear the checkedItems Property of the wj-multi-select control if you need to uncheck all selections. If you need to unselect then use the selectedItem property. Here is a fiddle which shows how it can be done.

    Thanks,

    Abhishek

  • Posted 14 September 2017, 2:51 am EST

    Thank you Abhishek. That worked great !

    How do you do the opposite, e.g. make items checked ? I tried this but it does not seem to work:

            $scope.CheckedItemsChanged = function (s, e) {
                for (var i = 0; i &lt; $scope.ProductCodes.length; i++) {
                    $scope.ProductCodes[i].Selected = s.selectedItem.Selected;
                    if (s.selectedItem.Selected)
                        $scope.ctx.multiselect.checkedItems.push($scope.ProductCodes[i]);
                }
    

    Edit: The forum window is hiding brackets in the code example, so it’s $scope.ProductCodes openbraket i closebraket

  • Posted 14 September 2017, 2:51 am EST

    I have created another fiddle to check all items of the Multi-Select. Please take a look and let me know if it works for you.

    Thanks,

    Abhishek

  • Posted 24 January 2021, 1:46 am EST

    Hi

    I want to deselect particular checkbox in dropdown on click of reset

  • Posted 24 January 2021, 11:22 pm EST

    Hi,

    You may set the checkedMemberPath property of the multiselect and then set the items value to false of the specified binding property to deselect the particular item. Please refer to the following sample demonstrating the same:

    https://codesandbox.io/s/wijmo-starter-forked-7o2fo?file=/src/index.js

    Regards

    Sharad

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels