GIJGO
Run Example
Close Window
<html> <head> <meta charset="utf-8" /> <title>Bootstrap TreeView with Checkboxes</title> <script src="https://code.jquery.com/jquery-3.3.1.min.js"></script> <script src="https://unpkg.com/gijgo@1.9.14/js/gijgo.min.js" type="text/javascript"></script> <link href="https://unpkg.com/gijgo@1.9.14/css/gijgo.min.css" rel="stylesheet" type="text/css" /> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous"> <style> .row { margin: 10px; } </style> </head> <body> <div class="container-fluid"> <div class="row"> <button id="btnSave" class="btn btn-default">Save Checked Nodes</button> </div> <div class="row"> <div id="tree"></div> </div> </div> <script type="text/javascript"> $(document).ready(function () { var tree = $('#tree').tree({ primaryKey: 'id', uiLibrary: 'bootstrap4', dataSource: '/Locations/Get', checkboxes: true }); $('#btnSave').on('click', function () { var checkedIds = tree.getCheckedNodes(); $.ajax({ url: '/Locations/SaveCheckedNodes', data: { checkedIds: checkedIds }, method: 'POST' }) .fail(function () { alert('Failed to save.'); }); }); }); </script> </body> </html>