Working on a basic application that recieves some records from a database which contain audio files. We've had the ability to display the records in a list view and we were able to include a Jplayer at the bottom (as a footer) playing a local music file. Is there a possibility of including the JPlayer inside of a template like so...
<
script
type
=
"text/x-kendo-template"
id
=
"template"
>
<
strong
>${data.StartTime}</
strong
>
<
strong
>"Hello World"</
strong
>
<!-- JPlayer here -->
</
script
>
The JPlayer is simply a div tag with a function that is called upon document being ready...
<div id=
"jquery_jplayer_1"
class=
"jp-jplayer"
></div>
<div class=
"jp-audio-container"
>
<div class=
"jp-audio"
>
<div class=
"jp-type-single"
>
<div id=
"jp_interface_1"
class=
"jp-interface"
>
<ul class=
"jp-controls"
>
<li><a href=
"#"
class=
"jp-play"
tabindex=
"1"
>play</a></li>
<li><a href=
"#"
class=
"jp-pause"
tabindex=
"1"
>pause</a></li>
<li><a href=
"#"
class=
"jp-mute"
tabindex=
"1"
>mute</a></li>
<li><a href=
"#"
class=
"jp-unmute"
tabindex=
"1"
>unmute</a></li>
</ul>
<div class=
"jp-progress-container"
>
<div class=
"jp-progress"
>
<div class=
"jp-seek-bar"
>
<div class=
"jp-play-bar"
></div>
</div>
</div>
<div class=
"jp-volume-bar-container"
>
<div class=
"jp-volume-bar"
>
<div class=
"jp-volume-bar-value"
></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
I know this is alot of code...just fairly lost on the subject of templates and how they work.
#hmenu {
float:right;
margin-top: 38px;
text-align: right;
margin-right: 20px;
}
<
div
id
=
"hmenu"
>
<
ul
id
=
"k-menu"
class
=
"k-content"
style
=
"float:right; margin-top:38px; margin-right:20px"
>
<
li
><
a
href
=
"index.html"
>Home</
a
></
li
>
<
li
>Products
<
ul
>
<
li
><
a
href
=
"products.html"
>Products</
a
>
<
div
id
=
"grid"
data-role
=
"grid"
data-sortable
=
"true"
data-pageable
=
"true"
data-editable
=
"inline"
data-bind
=
"source: gridSource"
data-row-template
=
"row-template"
></
div
>
<
script
id
=
"row-template"
type
=
"text/x-kendo-template"
>
<
tr
>
<
td
>
<
input
class
=
'k-textbox'
data-bind
=
"value: Name, source: gridSource"
width: '150px'/>
</
td
>
<
td
>
<
input
class
=
'k-textbox'
data-bind
=
"value: Price, source: gridSource"
width: '150px'/>
</
td
>
<
td
>
<
input
class
=
'k-textbox'
data-bind
=
"value: UnitsInStock, source: gridSource"
width: '150px'/>
</
td
>
</
tr
>
</
script
>
<
script
>
$("#grid").kendoGrid({
dataSource: {
schema: {
model: {
fields: {
Name: { validation: { required: true} },
Price: { validation: { required: true} },
UnitsInStock: { validation: { required: true } }
}
}
}
},
columns: [
{ field: "Name", title: "Name", width: "150px" },
{ field: "Price", title: "Price", width: "150px" },
{ field: "UnitsInStock", title: "Units In Stock", width: "150px" },
],
});
var viewModel = kendo.observable({
gridSource: [
{ Name: "1Chai", Price: 18.00, UnitsInStock: 39 },
{ Name: "2Chai", Price: 18.00, UnitsInStock: 39 },
{ Name: "3Chai", Price: 18.00, UnitsInStock: 39 },
{ Name: "4Chai", Price: 18.00, UnitsInStock: 39 },
{ Name: "5Chai", Price: 18.00, UnitsInStock: 39 },
],
displayGridSource: function() {
var gridSource1 = this.get("gridSource");
return $.map(gridSource1, function(product) {
return "\t" + kendo.stringify(product);
}).join(",\r\n");
}
});
kendo.bind($("table"), viewModel);
</
script
>
Scenario: using Kendo MVVM data-binding and listview template to create a form.
What works: I can reproduce the example on http://demos.kendoui.com/web/mvvm/source.html that displays data in a table.
- I can display data in a table from a page method using this template script
<
tr
><
td
data-bind
=
"text: Message"
></
td
><
td
data-bind
=
"text: CurrentState"
></
td
><
td
data-bind
=
"text: Subject"
></
td
></
tr
>
<
tr
><
td
data-bind
=
"text: Message"
></
td
></tr><tr>
<
td
data-bind
=
"text: CurrentState"
></
td
>
</tr><tr>
<
td
data-bind
=
"text: Subject"
></
td
></
tr
>