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

Preselect items not working with server virtualization

1 Answer 88 Views
MultiSelect
This is a migrated thread and some comments may be shown as answers.
Hema
Top achievements
Rank 1
Hema asked on 12 Apr 2016, 01:46 PM

Here is my scenario . When the page loads initially , I will select some items from the multiselect and when they go back to the same screen , I need to show those items as already selected . My problem is , if I go back , the widget displays only the last selected item ( sometimes I get all the items in the list, but this is inconsistent )  . I even tried to clear the filter and reset the datasource , but it takes the last filter value and displays only the last selected item( not all the items selected list ) . Please advice on what I am doing wrong .

$scope.init= function()
    {

ar kmsList = $('#benchmarkDropDown').data("kendoMultiSelect");
            if( kmsList != null )
            {                   
                kmsList.dataSource.data(managerInsightsDatabaseFactory.benchmarkObjs);                
                if( kmsList.dataSource.filter != null  ){
                    kmsList.dataSource.filter({});
                }    
                kmsList.value(managerInsightsDatabaseFactory.benchmarkIds);                                                
                kmsList.trigger("change");

}

 

<select kendo-multi-select id="benchmarkDropDown" class="k-content"
                   k-options="benchmarkDropdownOptions" ng-disabled="ui.disableBenchmarkMultiSelect" style="width: 100%">
                </select>   

In the factory 

            managerInsightsDatabaseFactory.benchmarkDropdown = new kendo.data.DataSource(
                                    {
                                        type: "json",
                                        transport: {
                                            read: "rest/reporting/filteredBenchMarks"
                                        },
                                        valuePrimitive: true,
                                        schema: {
                                            model: {
                                                fields: {
                                                  
                                                    name: { type: "string"},
                                                     id: { type: "string" }
                                                }
                                            }
                                        },
                                        pageSize: 100,
                                        serverPaging: true,
                                        serverFiltering: true
                                    });

 

 

 

1 Answer, 1 is accepted

Sort by
0
T. Tsonev
Telerik team
answered on 15 Apr 2016, 11:56 AM
Hi,

Please accept my apologies for the delayed response.

I've answered your forum post regarding the How-To. That should be fixed now.

I also notice that you don't use an ng-model binding on the MultiSelect instance.
Perhaps setting this can save you the trouble of calling the value method.

Let me know if you want to try the method suggested in the how-to.
If not, we can continue troubleshooting your approach here.

Regards,
T. Tsonev
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
Hema
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
Share this question
or