1
我有一個kendo網格,任何時候我去下一個頁面或使用我的過濾器,它不會激發我的點擊事件,我的instructionsButton
或我的tipsButton
。點擊事件正常工作,直到我與網格交互。Kendo Grid頁面更改禁用其他jquery
$(document).ready(function() {
$("#clientsDb").kendoGrid({
dataSource: {
pageSize: 15
},
sortable: true,
pageable: true,
filterable: true,
groupable: true,
scrollable: false,
resizable: true
}).data("kendoGrid");
$("#FieldFilter").keyup(function() {
var value = $("#FieldFilter").val();
var grid = $("#clientsDb").data("kendoGrid");
if (value) {
grid.dataSource.filter({
logic: "or",
filters: [
{ field: "TaskName", operator: "contains", value: value }
]
});
} else {
grid.dataSource.filter({});
}
});
kendo.ui.editor.ColorTool.prototype.options.palette = "basic";
$('.instructionsButton').one("click", function() {
var target = $(this).attr('data-target');
$(target + " " + ".editor").kendoEditor({
resizable: {
content: true,
toolbar: true
},
tools: [
"formatting",
"bold",
"italic",
"underline",
"justifyLeft",
"justifyCenter",
"justifyRight",
"justifyFull",
"insertUnorderedList",
"insertOrderedList",
"indent",
"outdent",
"createLink",
"unlink",
"foreColor",
"backColor"
],
paste: function (ev) {
ev.html = $(ev.html).text();
}
});
});
$('.tipsButton').one("click", function() {
var target = $(this).attr('data-target');
$(target + " " + ".editor").kendoEditor({
resizable: {
content: true,
toolbar: true
},
tools: [
"formatting",
"bold",
"italic",
"underline",
"justifyLeft",
"justifyCenter",
"justifyRight",
"justifyFull",
"insertUnorderedList",
"insertOrderedList",
"indent",
"outdent",
"createLink",
"unlink",
"foreColor",
"backColor"
],
paste: function (ev) {
ev.html = $(ev.html).text();
}
});
});
});
我有什麼
$(document).delegate('.tipsButton', "click", function() {
var target = $(this).attr('data-target');
$(target + " " + ".editor").kendoEditor({
resizable: {
content: true,
toolbar: true
},
tools: [
"formatting",
"bold",
"italic",
"underline",
"justifyLeft",
"justifyCenter",
"justifyRight",
"justifyFull",
"insertUnorderedList",
"insertOrderedList",
"indent",
"outdent",
"createLink",
"unlink",
"foreColor",
"backColor"
],
paste: function (ev) {
ev.html = $(ev.html).text();
}
});
});
我遇到的問題是,它只是創造了編輯器一遍又一遍。我只需要它每次點擊運行一次。 – TheDizzle
你是什麼意思,一遍又一遍地創建它?你想要一個編輯器來處理所有元素?如果是這樣,爲什麼不建立一個並根據需要隱藏/顯示(使用上面的授權代碼)? – Bardicer
頁面上有大約27個「任務」,並且每個人都有自己的編輯器。如果一次構建它們,則頁面加載是瘋狂的。所以我正在實施上面的代碼點擊。我的意思是,如果我把代表放在代替'.one'的位置,如果我點擊我的圖標來調出編輯器,它會將編輯器放在編輯器中。我添加了代碼 – TheDizzle