private function _generateJs($treeId)
    {
        $id = $this->getOption('id');
        $treeClearId = $treeId . '_clear';
        $view = \Mmi\App\FrontController::getInstance()->getView();
        $view->headScript()->appendScript("$(document).ready(function () {
				$('#$treeId').jstree({
					'core': {
						'themes': {
							'name': 'default',
							'variant': 'small',
							'responsive' : true,
							'stripes' : true
						},
						'multiple': " . ($this->getOption('multiple') ? 'true' : 'false') . ",
						'expand_selected_onload': true,
						'check_callback' : false
					}
				})
				.on('changed.jstree', function (e, data) {
					var selectedStr = '';
					if (0 in data.selected) {
						selectedStr = data.selected[0];
					}
					for (idx = 1, len = data.selected.length; idx < len; ++idx) {
						selectedStr = selectedStr.concat(';' + data.selected[idx])
					}
					$('#$id').val(selectedStr);
				});
				$('#$treeClearId').click(function () {
					$('#$id').val('');
					$('#$treeId').jstree('deselect_all');
				});
			});
		");
    }