使用 Kendo UI,请告诉我如何从多列表视图中删除元素。当我选择任何项目时,它给了我价值,但我无法删除选定的元素。
PSB代码:
var data = [
{ id: 1, text: "text 1" },
{ id: 2, text: "text 2" },
{ id: 3, text: "text 3" }
];
var d = $("#listview").kendoListView({
dataSource: data,
template: kendo.template($("#template").html()),
selectable: "multiple",
change: function() {
var index = this.select().index(),
dataItem = this.dataSource.view()[index];
var d = $("#listview").data("kendoListView");
alert(d.element.children().first());
d.remove(dataItem.text);
//log("id: " + dataItem.id + ", text: " + dataItem.text);
var selected = $.map(this.select(), function(item) {
return data[$(item).index()].id;
});
//data.remove(selected.id);
//console.log(data);
console.log(selected);
//console.log("[" + selected.join(", ") + "]");
}
});