Browse Source

2008-01-13 Igor Zelmanovich <[email protected]>

	* TreeView.cs:
	* TreeView.js:
	upgrade client side script due to changes in webform.js.		


svn path=/trunk/mcs/; revision=92774
Igor Zelmanovich 18 years ago
parent
commit
8ce3a695d6

+ 10 - 4
mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog

@@ -1,4 +1,10 @@
-2007-01-07 Igor Zelmanovich <[email protected]>
+2008-01-13 Igor Zelmanovich <[email protected]>
+
+	* TreeView.cs:
+	* TreeView.js:
+	upgrade client side script due to changes in webform.js.		
+
+2008-01-07 Igor Zelmanovich <[email protected]>
 
 	* BaseCompareValidator.cs:
 	* BaseValidator.cs:
@@ -10,7 +16,7 @@
 	refactoring: If page contents instance of IScriptManager, validators call 
 	it's API instead Page.ClientScript.									
 
-2007-01-07 Igor Zelmanovich <[email protected]>
+2008-01-07 Igor Zelmanovich <[email protected]>
 
 	* Button.cs:
 	* ImageButton.cs:
@@ -18,11 +24,11 @@
 	for TARGET_J2EE used CreateActionUrl instead ResolveClientUrl
 	in GetPostBackOptions.			
 
-2007-01-06 Igor Zelmanovich <[email protected]>
+2008-01-06 Igor Zelmanovich <[email protected]>
 
 	* DetailsView.cs: render invisible rows correct.
 
-2007-01-06 Igor Zelmanovich <[email protected]>
+2008-01-06 Igor Zelmanovich <[email protected]>
 
 	* DataControlField.cs: prevent infinite recursion
 

+ 10 - 7
mcs/class/System.Web/System.Web.UI.WebControls/TreeView.cs

@@ -1057,20 +1057,23 @@ namespace System.Web.UI.WebControls
 			script += string.Format ("{0}.showImage = {1};\n", ctree, ClientScriptManager.GetScriptLiteral (ShowExpandCollapse));
 			
 			if (ShowExpandCollapse) {
-				bool defaultImages = ShowLines || ImageSet != TreeViewImageSet.Custom || (ExpandImageUrl == "" && CollapseImageUrl == "");
-				script += string.Format ("{0}.defaultImages = {1};\n", ctree, ClientScriptManager.GetScriptLiteral (defaultImages));
 				ImageStyle imageStyle = GetImageStyle ();
-				if (!defaultImages) {
-					script += string.Format ("{0}.expandImage = {1};\n", ctree, ClientScriptManager.GetScriptLiteral (GetNodeImageUrl ("plus", imageStyle)));
-					script += string.Format ("{0}.collapseImage = {1};\n", ctree, ClientScriptManager.GetScriptLiteral (GetNodeImageUrl ("minus", imageStyle)));
-				}
+				script += string.Format ("{0}.expandImage = {1};\n", ctree, ClientScriptManager.GetScriptLiteral (GetNodeImageUrl ("plus", imageStyle)));
+				script += string.Format ("{0}.collapseImage = {1};\n", ctree, ClientScriptManager.GetScriptLiteral (GetNodeImageUrl ("minus", imageStyle)));
 				if (PopulateNodesFromClient)
 					script += string.Format ("{0}.noExpandImage = {1};\n", ctree, ClientScriptManager.GetScriptLiteral (GetNodeImageUrl ("noexpand", imageStyle)));
 			}
 
 			if (Page != null) {
 				script += string.Format ("{0}.form = {1};\n", ctree, Page.theForm);
-				script += string.Format ("{0}.PopulateNode = function(nodeId) {{ {1}; }};\n", ctree, Page.ClientScript.GetCallbackEventReference ("this.uid", "nodeId", "TreeView_PopulateCallback", "this.treeId + \" \" + nodeId", "TreeView_PopulateCallback", false));
+				script += string.Format (
+@"{0}.PopulateNode = function(nodeId) {{
+	" + Page.WebFormScriptReference + @".__theFormPostData = """";
+	" + Page.WebFormScriptReference + @".__theFormPostCollection = new Array();
+	" + Page.WebFormScriptReference + @".WebForm_InitCallback();
+	{1};
+}};
+", ctree, Page.ClientScript.GetCallbackEventReference ("this.uid", "nodeId", "TreeView_PopulateCallback", "this.treeId + \" \" + nodeId", "TreeView_PopulateCallback", false));
 				script += string.Format ("{0}.populateFromClient = {1};\n", ctree, ClientScriptManager.GetScriptLiteral (PopulateNodesFromClient));
 				script += string.Format ("{0}.expandAlt = {1};\n", ctree, ClientScriptManager.GetScriptLiteral (GetNodeImageToolTip (true, null)));
 				script += string.Format ("{0}.collapseAlt = {1};\n", ctree, ClientScriptManager.GetScriptLiteral (GetNodeImageToolTip (false, null)));

+ 2 - 7
mcs/class/System.Web/System.Web.UI.WebControls/TreeView.js

@@ -22,13 +22,8 @@ function TreeView_ToggleExpand (treeId, nodeId) {
 	
 	if (tree.showImage) {
 		var image = document.getElementById (spanId + "_img");
-		if (tree.defaultImages) {
-			if (expand) image.src = image.src.replace ("plus","minus");
-			else image.src = image.src.replace ("minus","plus");
-		} else {
-			if (expand) image.src = tree.collapseImage;
-			else image.src = tree.expandImage;
-		}
+		if (expand) image.src = tree.collapseImage;
+		else image.src = tree.expandImage;
 		var alt;
 		if (expand) alt = tree.collapseAlt;
 		else alt = tree.expandAlt;