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

Select all users for the meeting

1 Answer 42 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Denis Buchwald
Top achievements
Rank 1
Denis Buchwald asked on 08 Jul 2015, 02:58 PM

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

Sort by
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();
        mSelect.dataSource.insert(0, { Value: 0, Text: "All" });
        mSelect.bind("select", onSelect);
    }
 
    function onSelect(e) {
        var mSelect = this;
        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
Tags
Scheduler
Asked by
Denis Buchwald
Top achievements
Rank 1
Answers by
Vladimir Iliev
Telerik team
Share this question
or