This is a migrated thread and some comments may be shown as answers.

How stop propagation to the open event?

3 Answers 2195 Views
MultiSelect
This is a migrated thread and some comments may be shown as answers.
Chance
Top achievements
Rank 2
Chance asked on 01 Mar 2016, 07:06 PM

I have a multiselect with a 'clear all X' icon absolutely positioned to the right inside the .k-multiselect element. Everything works fine except I can not seem to stop the event from bubbling up to the open event when clicking. I do not want the list to open when clicking the close icon.

I considered filtering the target from the open event but could not find e.target inside the open event. Any ideas??

01.$("#multiSelector").kendoMultiSelect({
02.    dataTextField: "text",
03.    dataValueField: "id",
04.    dataSource: orgAccountsData,       
05.    dataBound: function () {
06.        var $closeBtn = $("<span />", {
07.            id: "multiselectCloseBtn"
08.        });
09.         
10.        $(".k-multiselect").append($closeBtn);
11. 
12.        $("#multiselectCloseBtn").off("click").on("click", function (e) {
13.            e.stopPropagation();
14.            e.preventDefault();
15. 
16.            $('#multiSelector').data("kendoMultiSelect").value([]);
17.        });
18.    }
19.});

3 Answers, 1 is accepted

Sort by
0
Petyo
Telerik team
answered on 03 Mar 2016, 12:26 PM
Hi,

I assume that you want to achieve something like this.

Regards,
Petyo
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Chance
Top achievements
Rank 2
answered on 03 Mar 2016, 03:28 PM

Yes but the issue is the button placement triggers the open event of the list. 

Your demo does not absolutely place the trigger over the multiselect area. 

Worst case I can try and attach the clear button to the right side of the multiselect - but I was hoping to implement it this way and figure out how to stop the list from opening.

 

Thanks,

Chance

 

0
Petyo
Telerik team
answered on 07 Mar 2016, 09:58 AM
Hello,

I did some ad-hoc positioning over here, and the event handling still works. Perhaps I am missing something? 

Regards,
Petyo
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
MultiSelect
Asked by
Chance
Top achievements
Rank 2
Answers by
Petyo
Telerik team
Chance
Top achievements
Rank 2
Share this question
or