Hi guys,
In the following code sample, how can I replace the actionsheet, so via the click of the button, the showDetails function is
called directly and view changed (whilst taking the row context across so I can get the selected row's values out)?
<div id="main" data-role="view" data-title="Schedule" data-model="viewModel" data-layout="default">
<ul id="items" data-role="listview" data-template="diaryItem" data-style="inset" data-bind="source: dataSource" ></ul>
<ul id="actions" data-role="actionsheet">
<li class="km-actionsheet-title">Select operation:</li>
<li><a href="#" data-action="viewModel.showDetails">Details</a></li>
</ul>
</div>
<!--details view-->
<div id="details" data-role="view" data-model="viewModel.selectedProduct" data-title="Details" data-layout="default">
<ul id="info" data-role="listview" data-style="inset">
<li>
Company Name:
<span data-bind="text: CompanyName"></span>
</li>
</ul>
</div>
<!--listview template-->
<script id="productItem" type="text/x-kendo-template">
<span>#= ProductName #</span>
// Clicking this button pops up the actionsheet, but I want to bypass it and call the showDetails function directly
<a class="btnActions"
data-role="button"
data-rel="actionsheet"
href="\\#actions"
data-actionsheet-context="#= itemID #">Actions</a>
</script>
<script type="text/javascript">
var app = new kendo.mobile.Application(),
validator,
viewModel = kendo.observable({
dataSource: new kendo.data.DataSource({
transport: {
read: {
url: "api/diary",
type: "GET"
}
},
batch: true,
pageSize: 20,
schema: {
data: "Data",
total: "Count"
}
}),
selectedItem: {},
showDetails: function (e) {
var item = viewModel.dataSource.get(e.context); //gets the ActionSheet context
viewModel.set("selectedItem", item); //sets the selected product
app.navigate("#details"); //navigates to details view
}
});
</script>
In the following code sample, how can I replace the actionsheet, so via the click of the button, the showDetails function is
called directly and view changed (whilst taking the row context across so I can get the selected row's values out)?
<div id="main" data-role="view" data-title="Schedule" data-model="viewModel" data-layout="default">
<ul id="items" data-role="listview" data-template="diaryItem" data-style="inset" data-bind="source: dataSource" ></ul>
<ul id="actions" data-role="actionsheet">
<li class="km-actionsheet-title">Select operation:</li>
<li><a href="#" data-action="viewModel.showDetails">Details</a></li>
</ul>
</div>
<!--details view-->
<div id="details" data-role="view" data-model="viewModel.selectedProduct" data-title="Details" data-layout="default">
<ul id="info" data-role="listview" data-style="inset">
<li>
Company Name:
<span data-bind="text: CompanyName"></span>
</li>
</ul>
</div>
<!--listview template-->
<script id="productItem" type="text/x-kendo-template">
<span>#= ProductName #</span>
// Clicking this button pops up the actionsheet, but I want to bypass it and call the showDetails function directly
<a class="btnActions"
data-role="button"
data-rel="actionsheet"
href="\\#actions"
data-actionsheet-context="#= itemID #">Actions</a>
</script>
<script type="text/javascript">
var app = new kendo.mobile.Application(),
validator,
viewModel = kendo.observable({
dataSource: new kendo.data.DataSource({
transport: {
read: {
url: "api/diary",
type: "GET"
}
},
batch: true,
pageSize: 20,
schema: {
data: "Data",
total: "Count"
}
}),
selectedItem: {},
showDetails: function (e) {
var item = viewModel.dataSource.get(e.context); //gets the ActionSheet context
viewModel.set("selectedItem", item); //sets the selected product
app.navigate("#details"); //navigates to details view
}
});
</script>