[Mapbender-commits] r7727 - trunk/mapbender/http/extensions/jsTree.v.1.0rc

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed Mar 30 05:31:07 EDT 2011


Author: kmq
Date: 2011-03-30 02:31:06 -0700 (Wed, 30 Mar 2011)
New Revision: 7727

Modified:
   trunk/mapbender/http/extensions/jsTree.v.1.0rc/jquery.jstree.js
   trunk/mapbender/http/extensions/jsTree.v.1.0rc/jquery.jstree.min.js
Log:
patch get_checked function to work when not checking recursively

Modified: trunk/mapbender/http/extensions/jsTree.v.1.0rc/jquery.jstree.js
===================================================================
--- trunk/mapbender/http/extensions/jsTree.v.1.0rc/jquery.jstree.js	2011-03-29 15:18:34 UTC (rev 7726)
+++ trunk/mapbender/http/extensions/jsTree.v.1.0rc/jquery.jstree.js	2011-03-30 09:31:06 UTC (rev 7727)
@@ -2266,7 +2266,12 @@
 			},
 			get_checked : function (obj) {
 				obj = !obj || obj === -1 ? this.get_container() : this._get_node(obj);
-				return obj.find("> ul > .jstree-checked, .jstree-undetermined > ul > .jstree-checked");
+                var s = this.get_settings();
+                if(s.checkbox.check_recursively){
+				    return obj.find("> ul > .jstree-checked, .jstree-undetermined > ul > .jstree-checked");
+                }else{
+				    return obj.find(" ul > .jstree-checked");
+                }
 			},
 			get_unchecked : function (obj) { 
 				obj = !obj || obj === -1 ? this.get_container() : this._get_node(obj);

Modified: trunk/mapbender/http/extensions/jsTree.v.1.0rc/jquery.jstree.min.js
===================================================================
--- trunk/mapbender/http/extensions/jsTree.v.1.0rc/jquery.jstree.min.js	2011-03-29 15:18:34 UTC (rev 7726)
+++ trunk/mapbender/http/extensions/jsTree.v.1.0rc/jquery.jstree.min.js	2011-03-30 09:31:06 UTC (rev 7727)
@@ -294,7 +294,7 @@
 else{$this.removeClass("jstree-checked jstree-undetermined").addClass("jstree-unchecked");}}
 else{if($this.children("ul").children(".jstree-unchecked, .jstree-undetermined").length){$this.parentsUntil(_this.get_container(),"li").andSelf().removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined");return false;}
 else{$this.removeClass("jstree-unchecked jstree-undetermined").addClass("jstree-checked");}}});}
-this.data.ui.selected=this.get_checked();this.__callback(obj);},check_node:function(obj){this.change_state(obj,false);console.log(obj);},uncheck_node:function(obj){this.change_state(obj,true);},check_all:function(){var _this=this;this.get_container().children("ul").children("li").each(function(){_this.check_node(this,false);});},uncheck_all:function(){var _this=this;this.get_container().children("ul").children("li").each(function(){_this.change_state(this,true);});},is_checked:function(obj){obj=this._get_node(obj);return obj.length?obj.is(".jstree-checked"):false;},get_checked:function(obj){obj=!obj||obj===-1?this.get_container():this._get_node(obj);return obj.find("> ul > .jstree-checked, .jstree-undetermined > ul > .jstree-checked");},get_unchecked:function(obj){obj=!obj||obj===-1?this.get_container():this._get_node(obj);return obj.find("> ul > .jstree-unchecked, .jstree-undetermined > ul > .jstree-unchecked");},show_checkboxes:function(){this.get_container().children("ul"
 ).removeClass("jstree-no-checkboxes");},hide_checkboxes:function(){this.get_container().children("ul").addClass("jstree-no-checkboxes");},_repair_state:function(obj){obj=this._get_node(obj);if(!obj.length){return;}
+this.data.ui.selected=this.get_checked();this.__callback(obj);},check_node:function(obj){this.change_state(obj,false);console.log(obj);},uncheck_node:function(obj){this.change_state(obj,true);},check_all:function(){var _this=this;this.get_container().children("ul").children("li").each(function(){_this.check_node(this,false);});},uncheck_all:function(){var _this=this;this.get_container().children("ul").children("li").each(function(){_this.change_state(this,true);});},is_checked:function(obj){obj=this._get_node(obj);return obj.length?obj.is(".jstree-checked"):false;},get_checked:function(obj){obj=!obj||obj===-1?this.get_container():this._get_node(obj);var s=this.get_settings();if(s.checkbox.check_recursively){return obj.find("> ul > .jstree-checked, .jstree-undetermined > ul > .jstree-checked");}else{return obj.find(" ul > .jstree-checked");}},get_unchecked:function(obj){obj=!obj||obj===-1?this.get_container():this._get_node(obj);return obj.find("> ul > .jstree-unchecked, .jst
 ree-undetermined > ul > .jstree-unchecked");},show_checkboxes:function(){this.get_container().children("ul").removeClass("jstree-no-checkboxes");},hide_checkboxes:function(){this.get_container().children("ul").addClass("jstree-no-checkboxes");},_repair_state:function(obj){obj=this._get_node(obj);if(!obj.length){return;}
 var a=obj.find("> ul > .jstree-checked").length,b=obj.find("> ul > .jstree-undetermined").length,c=obj.find("> ul > li").length;if(c===0){if(obj.hasClass("jstree-undetermined")){this.check_node(obj);}}
 else if(a===0&&b===0){this.uncheck_node(obj);}
 else if(a===c){this.check_node(obj);}



More information about the Mapbender_commits mailing list