当我单击面板栏本身上的按钮时,如何防止Kendo Panelbar折叠
我有一个放在Kendo Panelbar上的按钮。 我正在编写一个jQuery函数,以便当用户点击按钮面板栏时不会崩溃。 我提出的其他逻辑是单击按钮时没有回发。 我不能让这个工作。 帮助赞赏! :)这是代码片段。
$("#panelBarCarDetails").kendoPanelBar({ expandMode: "multiple" $('#btnTakeOwnership').click(function (e) { if (e.target) { e.preventDefault(); } });
我设法通过创建一个布尔变量找到解决问题的方法,该变量表示展开或折叠panelBar的可能性。 单击按钮时,它将“锁定”面板。
然后,在展开或折叠事件时,它将检查此变量的值并根据它来阻止或不依赖于它。
这是一个小提琴
var canExpandCollapse = true; $(document).ready(function () { $("#panelbar").kendoPanelBar({ expandMode: "multiple", collapse: cancelExpandCollapse, expand: cancelExpandCollapse }); }); function cancelExpandCollapse(e) { if (!canExpandCollapse) { e.preventDefault(); canExpandCollapse = true; } } $("#wu").click(function (e) { canExpandCollapse = false; });
- My Teammates
Some trash here
Some trash here
- Projects
- New Business Plan
- Sales Forecasts
- Q1 Forecast
- Q2 Forecast
- Q3 Forecast
- Q4 Forecast
- Sales Reports
- Programs
- Monday
- Tuesday
- Wednesday
- Thursday
- Friday
- Communication
返回false
表单按钮单击事件处理函数。
$('#btnTakeOwnership').click(function (e) { if (e.target) { e.preventDefault(); } return false; });
从恰帕斯回答改变了小提琴