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

List Binding Multiple Times

5 Answers 338 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Scott Rakestraw
Top achievements
Rank 1
Scott Rakestraw asked on 03 May 2013, 06:06 PM
I have a dropdownlist which is bound to a shared kendo datasource.  The shared datasource has already read it's data in.  When I am binding it to this drop down it is calling read on this dataset again.  If I create ddl without the data-bind it will not attempt to read the data a 2nd time.  How do I prevent the dropdownlist from forcing the datasource to read the data?

var ddl = $('<input data-bind="value:' + options.field + '" style="display:none;"/>')
            .appendTo(container);
 
ddl.kendoDropDownList({
    dataTextField: list.displayColumn,
    dataValueField: list.valueColumn,
    autoBind: false,
    optionLabel: optionLabel,
    dataSource: list.dataSource              
});

5 Answers, 1 is accepted

Sort by
0
Charles Benoualid
Top achievements
Rank 1
answered on 06 May 2013, 06:46 PM
I have the same problem, did you find a solution?
0
Alexander Valchev
Telerik team
answered on 07 May 2013, 09:02 AM
Hi guys,

To avoid the additional read request, please set the autoBind option of the widget to false.
data-auto-bind="false"

Kind regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Scott Rakestraw
Top achievements
Rank 1
answered on 07 May 2013, 01:08 PM
I have changed the code
var ddl = $('<input data-bind="value:' + options.field + '" style="display:none;" data-auto-bind="false" />').appendTo(container);
The same problem still exists.  It is forcing a second call to get the data.  When creating the drop down I had already specified autoBind false there.  It is now set in both places.
0
Alexander Valchev
Telerik team
answered on 09 May 2013, 12:17 PM
Hi Scott,

I prepared a small sample to test the solution - I checked the network tab and did not manage to observe any additional requests. Could you please check it and let me know what I am missing?

Kind regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Scott Rakestraw
Top achievements
Rank 1
answered on 09 May 2013, 07:08 PM
I found my problem.  I was doing a basic pub/sub so that the list could build itself after the data was returned in the schema data function.  I needed to change that publish event to run inside a setTimeout so it would run after the datasource was filled.
Tags
DropDownList
Asked by
Scott Rakestraw
Top achievements
Rank 1
Answers by
Charles Benoualid
Top achievements
Rank 1
Alexander Valchev
Telerik team
Scott Rakestraw
Top achievements
Rank 1
Share this question
or