Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $.getJSON(application_area, function(area){
- try{
- (function ($, undefined) {
- $.jstree.defaults.conditionalselect = function () { return true; };
- $.jstree.plugins.conditionalselect = function (options, parent){
- this.activate_node = function (obj, e) {
- if(this.settings.conditionalselect.call(this, this.get_node(obj))) {
- parent.activate_node.call(this, obj, e);
- }
- };
- };
- })(jQuery);
- createJSTree(area)
- }catch(ex){
- console.log(ex)
- }
- });
- function createJSTree(area) {
- $("#search_tree").keypress(function(){
- var searchString = $(this).val();
- $("#tree").jstree('search', searchString);
- })
- var j1 = $('#tree')
- const pplication_area = []
- j1.jstree({
- "conditionalselect" : function (node) {
- return node.parent === '#' || node.parent === "1" || node.parent === "415" ? false : true;
- },
- 'core': {
- "multiple": true,
- "themes": {
- "theme": "classic",
- "dots": true,
- "variant": "small",
- "icons": false,
- "responsive":true,
- },
- 'data':area
- },
- "search":{
- "case_insensitive":true,
- "show_only_matches":true
- },
- "checkbox": {
- "keep_selected_style": false,
- },
- "plugins": ["wholerow", "checkbox", "search","conditionalselect"],
- }).bind("before.jstree", function (e, data) {
- if (data.func === "check_node") {
- if (j1.jstree('get_checked').length >= 1) {
- e.preventDefault();
- return false;
- }
- }
- });
- }
Add Comment
Please, Sign In to add comment