Skip to content

Commit a4b7231

Browse files
committed
Add How To article. Closes telerik/kendo #2878
1 parent 044a414 commit a4b7231

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
---
2+
title: Select value from another view
3+
page_title: Select value from another view
4+
description: Select value from another view
5+
---
6+
7+
# Select value from another view
8+
9+
The example below demonstrates how to navigate to a child view from a ListView, select an item and return back to the parent view showing the selected item.
10+
11+
#### Example:
12+
13+
```html
14+
<div data-role="view" data-model="app.models.survey" data-title="Survey" data-stretch="true" id="survey">
15+
<form>
16+
<ul data-role="listview" data-type="group">
17+
<li class="detail-text">
18+
Did you order an appetizer?
19+
<ul>
20+
<li>
21+
<a href="locations">Location <span class="location" data-bind="html: selectedLocation"></span></a>
22+
</li>
23+
</ul>
24+
<li>
25+
</ul>
26+
</form>
27+
</div>
28+
29+
<div data-role="view" id="locations" data-transition="slide" data-model="app.models.locations">
30+
<ul data-role="listview" data-bind="click: selectLocation, source: locations" data-template="locations-template">
31+
</ul>
32+
</div>
33+
34+
<script id="locations-template" type="text/x-kendo-template">
35+
#: text #
36+
</script>
37+
<script>
38+
(function() {
39+
40+
var survey = new kendo.observable({
41+
selectedLocation: null
42+
});
43+
44+
var locations = new kendo.observable({
45+
locations: new kendo.data.DataSource({
46+
data: [
47+
{ text: "north" },
48+
{ text: "south" },
49+
{ text: "east" },
50+
{ text: "west" }
51+
]
52+
}),
53+
selectLocation: function(e) {
54+
survey.set("selectedLocation", e.dataItem.text);
55+
app.navigate("#survey");
56+
}
57+
});
58+
59+
var app = new kendo.mobile.Application(document.body);
60+
61+
window.app = {};
62+
window.app.models = {
63+
survey: survey,
64+
locations: locations
65+
};
66+
67+
}());
68+
</script>
69+
```

0 commit comments

Comments
 (0)