Страница с несколькими Kendo Multiselect - PullRequest
0 голосов
/ 19 сентября 2019

На моей html-странице есть 2 поля kendo Multiselect.После того, как я выбрал элементы из 1-го мультиселектора и пошел, чтобы выбрать элементы из второго мультиселекта, 1-е поле мультиселекта становится пустым (означая, что все элементы, которые я выбрал для первого мультиселекта, удалены).Как мы решаем эту проблему ??

Это ожидаемое поведение ???

Вот код angularJS & html

 $scope.select1Options = {
            placeholder: "Search Par...",
            noDataTemplate: 'No Partner's found',
            dataTextField: "Name",
            dataValueField: "Id",
            valuePrimitive: false,
            autoBind: false,
            //filter: "contains",
            //animation: {
            //    close: {
            //        effects: "fadeOut zoom:out",
            //        duration: 300
            //    },
            //    open: {
            //        effects: "fadeIn zoom:in",
            //        duration: 300
            //    }
            //},
            minLength: 3,
            dataSource: {
                //type: "odata",
                serverFiltering: true,
                serverPaging: true,
                pageSize: 10,
                filtering: function (e) {
                    var filter = e.filter;

                    if (!filter.value) {
                        //prevent filtering if the filter does not value
                        e.preventDefault();
                    }
                },
                transport: {

                    read: {
                        url: "/Partner/Configuration/GetPartners",
                        type: 'GET',
                        dataType: 'json'
                    }, 
                    parameterMap: function (options, type) {
                        if (type === "read") {
                            var paramMap = kendo.data.transports.odata.parameterMap(options);
                            delete paramMap.$inlinecount; // <-- remove inlinecount parameter.
                            delete paramMap.$format; // <-- remove format parameter.
                            return { searchCriteria: options.filter.filters[0].value };
                        }
                    },
                    schema: {
                        data: function (data) {
                            return data; // <-- The result is just the data, it doesn't need to be unpacked.
                        },
                        total: function (data) {
                            return data.length; // <-- The total items count is the data length, there is no .Count to unpack.
                        }
                    }
                }


            },
            select: function(e) {

                $('select[name="multi_select1[]"]').change(function() {
                    $scope.partner = $(this).val();
                });
            }
        };

        $scope.select2Options = {
            placeholder: "Search Emp...",
            noDataTemplate: 'No Employers&apos;s found',
            dataTextField: "Name",
            dataValueField: "EmpId",
            valuePrimitive: false,
            autoBind: false,
            //filter: "contains",
            //animation: {
            //    close: {
            //        effects: "fadeOut zoom:out",
            //        duration: 300
            //    },
            //    open: {
            //        effects: "fadeIn zoom:in",
            //        duration: 300
            //    }
            //},
            minLength: 3,
            dataSource: {
                //type: "odata",
                serverFiltering: true,
                serverPaging: true,
                pageSize: 10,
                filtering: function (e) {
                    var filter = e.filter;

                    if (!filter.value) {
                        //prevent filtering if the filter does not value
                        e.preventDefault();
                    }
                },
                transport: {

                    read: {
                        url: "/Partner/Configuration/GetEmployers",
                        type: 'GET',
                        dataType: 'json'
                    },
                    parameterMap: function (options, type) {
                        if (type === "read") {
                            var paramMap = kendo.data.transports.odata.parameterMap(options);
                            delete paramMap.$inlinecount; // <-- remove inlinecount parameter.
                            delete paramMap.$format; // <-- remove format parameter.
                            return { searchText: options.filter.filters[0].value };
                        }
                    },
                    schema: {
                        data: function (data) {
                            return data; // <-- The result is just the data, it doesn't need to be unpacked.
                        },
                        total: function (data) {
                            return data.length; // <-- The total items count is the data length, there is no .Count to unpack.
                        }
                    }
                }


            },
            select: function (e) {

                $('select[name="multi_select2[]"]').change(function () {
                    $scope.employer = $(this).val();
                });
            }
        };
 <select kendo-multi-select k-options="select1Options" k-ng-model="configuration1" k-min-length="3" name="multi_select1[]" class="form-control" ></select>

 <select kendo-multi-select k-options="select2Options" k-ng-model="configuration2" k-min-length="3" name="multi_select2[]" class="form-control" ></select>

Любая помощь будет принята с благодарностью.

...