Clear Function

1 Answer 2437 Views
MultiSelect
Marc
Top achievements
Rank 1
Marc asked on 13 Feb 2017, 08:36 AM

Hi, Is there a way to fire the clear method of a kendo multiselect via a button click? I have ten multiselects, and need a way to quickly clear them all.

Thanks

Marc

1 Answer, 1 is accepted

Sort by
0
Accepted
Ivan Danchev
Telerik team
answered on 13 Feb 2017, 09:23 AM
Hello Marc,

The selected value of the MultiSelect can be cleared by calling its value method with an empty string as a parameter. Here's a sample dojo, which demonstrates this.

Regards,
Ivan Danchev
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Marc
Top achievements
Rank 1
commented on 13 Feb 2017, 09:24 AM

Hi Ivan,

That is perfect, thank you so much!

Marc

Marc
Top achievements
Rank 1
commented on 13 Feb 2017, 09:36 AM

Hi Ivan. Some of my dropdowns are created using AngularJS.

<select kendo-multi-select
multiple="multiple"
id="categoryMultipleSelect">

Is there something special I need to do to clear these, as your solution does not appear to work in this case?

Thanks!

Marc
Top achievements
Rank 1
commented on 14 Feb 2017, 02:55 PM

I think the issue is that my multi select have their own custom onchange events. When I clear the multi select value (using .value("") ), I then fire the change event, which calls my custom event, which updates the multi selects k-ng-model attribute to an empty array. The only thing which isn't happening, is the actual component being rerendered on the screen. Any ideas?
Ivan Danchev
Telerik team
commented on 15 Feb 2017, 07:22 AM

Hello Marc,

Could you please demonstrate the issue with the MultiSelect not being properly rendered in the following dojo, which shows a MultiSelect + Angular scenario? This will allows us to further investigate what causes the unexpected behavior you describe.

Regards,
Ivan Danchev
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Marc
Top achievements
Rank 1
commented on 15 Feb 2017, 07:29 AM

Hi Ivan, Its difficult to show you, as the multuiselect is inside an Angular directive. I believe this is the issue, as I have tried watching a scope variable inside my directive, and then using the above answer you gave inside the directive, and this works fine.

I believe this to be quite a unique occurance, and am happy to accept your answer as correct!

Thanks,

Marc

Tags
MultiSelect
Asked by
Marc
Top achievements
Rank 1
Answers by
Ivan Danchev
Telerik team
Share this question
or