or
<
span
class
=
"handler"
>
<
span
class
=
"icon icon-drag icon-drag-dims"
></
span
>
</
span
>
.handler {
border-right
:
1px
solid
#eaeaea
;
width
:
40px
;
height
:
44px
;
display
: inline-
block
;
text-align
:
center
;
}
.handler .
icon
{
vertical-align
:
middle
;
}
.
icon
{
display
: inline-
block
;
}
.icon-drag {
background-position
:
0
-391px
;
background-repeat
:
no-repeat
;
background-image
:
url
(../../images/sprites/icons.svg);
}
.icon-drag-dims {
width
:
21px
;
height
:
21px
;
}
<!DOCTYPE html>
<
html
>
<
head
>
<
meta
charset
=
"utf-8"
>
<
title
>Untitled</
title
>
<
link
rel
=
"stylesheet"
href
=
"http://cdn.kendostatic.com/2014.1.318/styles/kendo.common.min.css"
>
<
link
rel
=
"stylesheet"
href
=
"http://cdn.kendostatic.com/2014.1.318/styles/kendo.rtl.min.css"
>
<
link
rel
=
"stylesheet"
href
=
"http://cdn.kendostatic.com/2014.1.318/styles/kendo.default.min.css"
>
<
link
rel
=
"stylesheet"
href
=
"http://cdn.kendostatic.com/2014.1.318/styles/kendo.dataviz.min.css"
>
<
link
rel
=
"stylesheet"
href
=
"http://cdn.kendostatic.com/2014.1.318/styles/kendo.dataviz.default.min.css"
>
<
link
rel
=
"stylesheet"
href
=
"http://cdn.kendostatic.com/2014.1.318/styles/kendo.mobile.all.min.css"
>
<
script
src
=
"http://code.jquery.com/jquery-1.9.1.min.js"
></
script
>
<
script
src
=
"http://cdn.kendostatic.com/2014.1.318/js/kendo.all.min.js"
></
script
>
</
head
>
<
body
>
<
div
style
=
"width: 600px;"
>
<
div
>
<
a
id
=
"btnAdd"
class
=
"k-button k-button-icontext k-add-button"
href
=
"#"
><
span
class
=
"k-icon k-add"
></
span
>Add new record</
a
>
</
div
>
<
div
>
<
div
id
=
"listView"
></
div
>
</
div
>
</
div
>
<
script
type
=
"text/x-kendo-tmpl"
id
=
"listTemplate"
>
<
div
class
=
"item"
>
<
span
class
=
"handler"
> </
span
>
<
span
>#:ProductName#</
span
>
<
a
class
=
"k-button k-button-icontext k-edit-button rfm"
href
=
"\\#"
><
span
class
=
"k-icon k-edit"
></
span
></
a
>
<
a
class
=
"k-button k-button-icontext k-delete-button rfm"
href
=
"\\#"
><
span
class
=
"k-icon k-delete"
></
span
></
a
>
</
div
>
</
script
>
<
script
type
=
"text/x-kendo-tmpl"
id
=
"editTemplate"
>
<
div
class
=
"item"
>
<
span
class
=
"handler"
> </
span
>
<
input
type
=
"text"
class
=
"k-textbox"
data-bind
=
"value:ProductName"
name
=
"ProductName"
required
=
"required"
validationMessage
=
"required"
/>
<
span
data-for
=
"ProductName"
class
=
"k-invalid-msg"
></
span
>
<
a
class
=
"k-button k-button-icontext k-update-button"
href
=
"\\#"
><
span
class
=
"k-icon k-update"
></
span
></
a
>
<
a
class
=
"k-button k-button-icontext k-cancel-button"
href
=
"\\#"
><
span
class
=
"k-icon k-cancel"
></
span
></
a
>
</
div
>
</
script
>
<
script
>
var products = [{
ProductID : 1,
ProductName : "Chai"
}, {
ProductID : 2,
ProductName : "Chang"
}, {
ProductID : 3,
ProductName : "Aniseed Syrup"
}, {
ProductID : 4,
ProductName : "Chef Anton's Cajun Seasoning"
}];
$(document).ready(function() {
var dataSource = new kendo.data.DataSource({
transport: {
create: function(options) {
console.log("datasource create :: ", options);
console.log("data :: ", options.data);
alert("datasource create: New product name = " + options.data.ProductName );
options.success(products);
},
read: function(options) {
console.log("datasource read", options);
options.success(products);
},
update: function(options) {
console.log("datasource update", options);
console.log("data :: ", options.data);
alert("datasource update: Altered product name = " + options.data.ProductName + " for product id " + options.data.ProductID );
options.success(products);
},
destroy: function(options) {
console.log("datasource destroy", options);
console.log("data :: ", options.data);
alert("datasource destroy: Deleted product id = " + options.data.ProductID );
options.success(products);
}
},
schema: {
model: {
id: "ProductID",
fields: {
ProductName : { type: "string" },
}
}
}
});
var listView = $("#listView").kendoListView({
dataSource: dataSource,
template: kendo.template($("#listTemplate").html()),
editTemplate: kendo.template($("#editTemplate").html())
}).data("kendoListView");
/* REMOVE COMMENT TO SEE ISSUES WITH MAKING THE LISTVIEW SORTABLE
$("#listView").kendoSortable({
cursor: "move",
handler: ".handler",
hint:function(element) {
return element.clone().addClass("hint");
},
placeholder: function(element) {
return element.clone().css("opacity", 0.1);
},
change: function(e) {
console.log("You sorted me!");
}
});
END OF COMMENT */
$("#btnAdd").click(function(e) {
listView.add();
e.preventDefault();
});
});
</
script
>
<
style
scoped>
.rfm {
float:right;
margin-right: 5px;
margin-top: 5px;
}
span.k-invalid-msg
{
position: absolute;
margin-left: 6px;
}
.item {
margin: 15px;
padding: 0 10px 0 0;
min-width: 200px;
background-color: #fff;
border: 1px solid rgba(0,0,0,.1);
border-radius: 3px;
font-size: 1.3em;
line-height: 2.5em;
}
.handler {
display: inline-block;
width: 30px;
margin-right: 10px;
border-radius: 3px 0 0 3px;
background: url('http://demos.telerik.com/kendo-ui/content/web/sortable/handle.png') no-repeat 50% 50% #ccc;
}
.handler:hover {
background-color: #2db245;
}
.placeholder {
width: 298px;
border: 1px solid #2db245;
}
.hint {
border: 2px solid #2db245;
border-radius: 6px;
width: 400px;
}
.hint .handler {
background-color: #2db245;
}
</
style
>
</
body
>
</
html
>