This article mainly introduces how to implement the bootstrap-treeview Custom Event double-click event, for more information, see bootstrap-treeview. It is a very cool jQuery Multi-Level list tree plug-in based on bootstrap. Based on Twitter Bootstrap, The jQuery plug-in displays some inherited tree structures, such as view trees and list trees, in a simple and elegant manner. But I don't know why this plug-in does not have a double-click event.
After multiple tests, use $ ('# tree '). dblclick (function () {}) and method $ ('# tree '). on ('dblclick', function () {}) does not work! Think twice about it. Finally, the rescue team solved the problem, but it seemed not very elegant, but it was still possible to deliver the problem.
The bootstrap-treeview built-in events "nodeSelected" and "nodeUnselected" are used in this solution ". double-click on the treeview node will trigger the selected event and cancel the selected event. Calculating the time interval between the two events can simulate the double-click event effect. The interval between double-click events and clicking the left mouse button each time. manual operation is 300 milliseconds.
The Code is as follows: