Skip to content

Instantly share code, notes, and snippets.

View jbristowe's full-sized avatar
👨‍💻
"It's complicated."

John Bristowe jbristowe

👨‍💻
"It's complicated."
View GitHub Profile
@jbristowe
jbristowe / gist:2373272
Created April 13, 2012 03:06
Target Element and Template for Rendering ListView Items
<div id="listView"></div>
<script type="text/x-kendo-tmpl" id="template">
<div class="tweet">
<img class="profileImage" src="${profile_image_url}" />
<strong>${from_user_name}</strong>
<a href="http://twitter.com/${from_user}">@${from_user}</a>
<p class="text">${text}</p>
</div>
</script>
@jbristowe
jbristowe / gist:2373296
Created April 13, 2012 03:07
ListView Initialization with Remote DataSource (Twitter)
var dataSource = new kendo.data.DataSource({
transport: {
read: {
url: "http://search.twitter.com/search.json",
contentType: "application/json; charset=utf-8",
type: "GET",
dataType: "jsonp",
data: {
q: "#KendoUI"
}
@jbristowe
jbristowe / gist:2373305
Created April 13, 2012 03:09
Target Elements for ListView and Pager with Template for Rendering ListView Items
<div id="listView"></div>
<div id="pager"></div>
<script type="text/x-kendo-tmpl" id="template">
<div class="tweet">
<img class="profileImage" src="${profile_image_url}" />
<strong>${from_user_name}</strong>
<a href="http://twitter.com/${from_user}">@${from_user}</a>
<p class="text">${text}</p>
</div>
@jbristowe
jbristowe / gist:2373309
Created April 13, 2012 03:11
ListView and Pager Initialization with Remote DataSource (Twitter)
var dataSource = new kendo.data.DataSource({
transport: {
read: {
url: "http://search.twitter.com/search.json",
contentType: "application/json; charset=utf-8",
type: "GET",
dataType: "jsonp",
data: {
q: "#KendoUI"
}
@jbristowe
jbristowe / gist:2373322
Created April 13, 2012 03:14
Target Elements with Template and Alternating Template for Rendering ListView Items
<div id="listView"></div>
<div id="pager"></div>
<script type="text/x-kendo-tmpl" id="template">
<div class="tweet">
<img class="profileImage" src="${profile_image_url}" />
<strong>${from_user_name}</strong>
<a href="http://twitter.com/${from_user}">@${from_user}</a>
<p class="text">${text}</p>
</div>
@jbristowe
jbristowe / gist:2373360
Created April 13, 2012 03:18
ListView Initialization with an Edit Template
var listView = $("#listView").kendoListView({
template: kendo.template($("#template").html()),
editTemplate: kendo.template($("#editTemplate").html()),
altTemplate: kendo.template($("#altTemplate").html())
});
@jbristowe
jbristowe / gist:2373365
Created April 13, 2012 03:19
Enabling ListView Paging, Selection, Navigation and Editing
$(document).ready(function(){
$("#listView").kendoListView({
pageable: true,
selectable: true,
navigatable: true,
editable: true
});
});
@jbristowe
jbristowe / gist:2373527
Created April 13, 2012 03:48
ListView Event Handling for User Interactions
var listView = $("#listView").kendoListView({
dataSource: dataSource,
template: kendo.template($("#template").html()),
editTemplate: kendo.template($("#editTemplate").html())
}).delegate(".k-edit-button", "click", function(e) {
listView.edit($(this).closest(".product-view"));
e.preventDefault();
}).delegate(".k-delete-button", "click", function(e) {
listView.remove($(this).closest(".product-view"));
e.preventDefault();
@jbristowe
jbristowe / gist:2373579
Created April 13, 2012 04:02
Selectable ListView
$("#listView").kendoListView({
dataSource: dataSource,
pageable: true,
selectable: "multiple",
template: kendo.template($("#template").html())
});​
@jbristowe
jbristowe / gist:2373597
Created April 13, 2012 04:09
ListView Change Event
$("#listView").kendoListView({
change: function(e) {
var data = dataSource.view(),
selected = $.map(this.select(), function(item) {
return data[$(item).index()].ProductName;
});
// index selected or read item information through data
}
});