<%@ page contentType="text/html;charset=UTF-8" %>
	<script>
		$(document).ready(function() {
			var to = false;
			$('#search_q').keyup(function () {
				if(to) { clearTimeout(to); }
				to = setTimeout(function () {
					var v = $('#search_q').val();
					$('#carKind1jsTree').jstree(true).search(v);
				}, 250);
			});
			$('#carKind1jsTree').jstree({
				'core' : {
					"multiple" : false,
					"animation" : 0,
					"themes" : { "variant" : "large", "icons":true , "stripes":true},
					'data' : {
						"url" : "${ctx}/sg/progress/treeData",
						"dataType" : "json" 
					}
				},
				"conditionalselect" : function (node, event) {
					return false;
				},
				'plugins': ["contextmenu", 'types', 'wholerow', "search"],
				"contextmenu": {
					"items": function (node) {
						var tmp = $.jstree.defaults.contextmenu.items();
						delete tmp.create.action;
						delete tmp.rename.action;
						tmp.rename = null;
						return tmp;
					}

				},
				"types":{
					'default' : { 'icon' : 'fa fa-group' },
					'1' : {'icon' : 'fa fa-folder'},
					'2' : {'icon' : 'fa fa-home' },
					'3' : { 'icon' : 'fa fa-file-text-o'},
					'4' : { 'icon' : 'fa fa-umbrella' }
				}

			}).bind("activate_node.jstree", function (obj, e) {
				var node = $('#carKind1jsTree').jstree(true).get_selected(true)[0];
				var opt = {
					silent: true,
					query:{
						'projectYear':node.id
					}
				};
				$("#kindId").val(node.id);
				$("#kindName").val(node.text);
				$('#car1Table').bootstrapTable('refresh',opt);
			}).on('loaded.jstree', function() {
				$("#carKind1jsTree").jstree('open_all');
			});
		});

		function refreshTree() {
	            $('#carKind1jsTree').jstree("refresh");
	        }
	</script>