Is there a way to "Select All" users in the editor popup?
I'm using .AutoClose(false), but that's not enough for the client. They want to select all users.
I'm using editable.TemplateName("CustomEditorTemplate");
1 Answer, 1 is accepted
0
Vladimir Iliev
Telerik team
answered on 10 Jul 2015, 04:47 AM
Hello,
Creating "Select All" option for the MultiSelect widget would require custom solution - for example you can use the "Edit" event of the Scheduler to find the target editor, insert the "All" option and bind the "Select" method. Finally when given value is selected you can check if it's the new "All" option to add all items from the dataSource as widget value. Please check the example implementation below:
<script>
function onEdit(e) {
//selector is valid when only one multiSelect widget is available in editor
var mSelect = e.container.find("[data-role=multiselect]").getKendoMultiSelect();
var dataItem = mSelect.dataSource.view()[e.item.index()];
var values = mSelect.value();
var all = $.grep(values, function (value) {
return value == 0;
});
if (dataItem.Value === 0) {
values = $.grep(mSelect.dataSource.data(), function (item) {
return item.Value !== 0;
});
values = $.map(values, function (item) {
return item.Value;
});
e.preventDefault();
setTimeout(function () {
mSelect.value(values);
mSelect.trigger("change");
});
}
}
</script>
Regards,
Vladimir Iliev
Telerik
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Feedback Portal
and vote to affect the priority of the items