Explorar el Código

Remove min-rows and stop hiding datagridbody. What was the purpose of this? Perhaps an old hack to increase performance. If so, it shouldn't matter anymore. This created problems with focusing on document show.

Michael Ragazzon hace 6 años
padre
commit
2287f1cac8

+ 0 - 2
Include/RmlUi/Controls/ElementDataGrid.h

@@ -146,8 +146,6 @@ private:
 
 
 	// The block element that contains all our rows. Only used for applying styles.
 	// The block element that contains all our rows. Only used for applying styles.
 	Core::Element* body;
 	Core::Element* body;
-	// Stores if the body has already been made visible by having enough rows added.
-	bool body_visible;
 };
 };
 
 
 }
 }

+ 1 - 1
Samples/invaders/data/high_score.rml

@@ -41,7 +41,7 @@
 		</style>
 		</style>
 	</head>
 	</head>
 	<body template="window" onload="add_score">
 	<body template="window" onload="add_score">
-		<datagrid source="high_scores.scores" onrowupdate="check_input" min-rows="10">
+		<datagrid source="high_scores.scores" onrowupdate="check_input">
 			<col fields="name,name_required" formatter="name" width="40%">Pilot</col>
 			<col fields="name,name_required" formatter="name" width="40%">Pilot</col>
 			<col fields="colour" formatter="ship" width="20%">Ship</col>
 			<col fields="colour" formatter="ship" width="20%">Ship</col>
 			<col fields="wave" width="20%">Wave</col>
 			<col fields="wave" width="20%">Wave</col>

+ 1 - 9
Source/Controls/ElementDataGrid.cpp

@@ -53,12 +53,10 @@ ElementDataGrid::ElementDataGrid(const Rml::Core::String& tag) : Core::Element(t
 
 
 	element = Core::Factory::InstanceElement(this, "*", "datagridbody", attributes);
 	element = Core::Factory::InstanceElement(this, "*", "datagridbody", attributes);
 	body = element.get();
 	body = element.get();
-	body->SetProperty(Core::PropertyId::Display, Core::Property(Core::Style::Display::None));
+	body->SetProperty(Core::PropertyId::Display, Core::Property(Core::Style::Display::Block));
 	body->SetProperty(Core::PropertyId::Width, Core::Property(Core::Style::Width::Auto));
 	body->SetProperty(Core::PropertyId::Width, Core::Property(Core::Style::Width::Auto));
 	AppendChild(std::move(element));
 	AppendChild(std::move(element));
 
 
-	body_visible = false;
-
 	element = Core::Factory::InstanceElement(this, "#rmlctl_datagridrow", "datagridroot", attributes);
 	element = Core::Factory::InstanceElement(this, "#rmlctl_datagridrow", "datagridroot", attributes);
 	root = static_cast<ElementDataGridRow*>(element.get());
 	root = static_cast<ElementDataGridRow*>(element.get());
 	root->SetProperty(Core::PropertyId::Display, Core::Property(Core::Style::Display::None));
 	root->SetProperty(Core::PropertyId::Display, Core::Property(Core::Style::Display::None));
@@ -238,12 +236,6 @@ void ElementDataGrid::OnUpdate()
 	{
 	{
 		DispatchEvent(Core::EventId::Rowupdate, Rml::Core::Dictionary());
 		DispatchEvent(Core::EventId::Rowupdate, Rml::Core::Dictionary());
 	}
 	}
-	
-	if (!body_visible && (!any_new_children || root->GetNumLoadedChildren() >= GetAttribute("min-rows", 0)))
-	{
-		body->SetProperty(Core::PropertyId::Display, Core::Property(Core::Style::Display::Block));
-		body_visible = true;
-	}
 }
 }