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

Refresh databound select

2 Answers 100 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Brad
Top achievements
Rank 1
Brad asked on 20 Mar 2014, 06:29 PM
I have the following view with a select object:

<div data-role="view" id="add-bet" data-layout="default" data-transition="overlay:down" class="add-bet-view" data-show="app.AddBet.show" data-model="app.AddBet">
<select id="addBetUsers" data-role="selectlist" data-text-field="username" data-value-field="member_id" data-bind="source: users" data-source="app.AddBet.users"></select>
</div>

The method app.AddBet.users is local to this view's model, but makes a call to another data model and retrieves and array of users which works perfectly on initial load. If I then update that users datasource 'App.Users' in another view of the app, I need to be able to refresh the select statement above. I know I can fire actions from the users model using 'change()' but I cannot force the view above or the select object to refresh their data. I have dug through every method in the Kendo UI docs, but can't seem to find anything. What I'm really looking for is the equivalent of this for a select object:  

$("#addBetUsers").data("kendoMobileListView").dataSource.read();  -> except I can't find anyway to call the dataSource and read it for either 'kendoMobileView' or 'kendoSelectList'

2 Answers, 1 is accepted

Sort by
0
Brad
Top achievements
Rank 1
answered on 20 Mar 2014, 06:58 PM
To further clarify, this view is not a list, nor does it have its own data model. It is merely one of many forms in the app that needs to call upon the central Users data model. I understand how to refresh items within listviews when the data source changes, but none of that seems to work for this object.

I can brute force fix this by creating the select list on show() for the view each time, but I would prefer to just tell the select obj to call a function and rebind the data when I need to.
0
Alexander Valchev
Telerik team
answered on 24 Mar 2014, 01:45 PM
Hello Brad,

I noticed that you are using both data-bind="source: (...)" and data-source="(...)" which is not correct (for a select element the data-source attribute should not work). Also the select element have unknown to me data-role - Kendo UI does not have a selectlist widget. Could you please provide a more complete sample which demonstrates your exact implementation and the issue in question? You can use Kendo UI Dojo to prepare a small and easy to share runnable sample.

Regards,
Alexander Valchev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
General Discussions
Asked by
Brad
Top achievements
Rank 1
Answers by
Brad
Top achievements
Rank 1
Alexander Valchev
Telerik team
Share this question
or