Skip to content
This repository
Browse code

Respect displayFields in GridFieldPrintButton

Provides more coherent and expected default behaviour
  • Loading branch information...
commit 80feb8c0b4b581255315e0f99fe8a77385302ba7 1 parent 703c10a
Ingo Schommer authored January 14, 2013

Showing 1 changed file with 8 additions and 3 deletions. Show diff stats Hide diff stats

  1. 11  forms/gridfield/GridFieldPrintButton.php
11  forms/gridfield/GridFieldPrintButton.php
@@ -91,9 +91,14 @@ public function handlePrint($gridField, $request = null) {
91 91
 	 * Export core.
92 92
  	 */
93 93
 	public function generatePrintData($gridField) {
94  
-		$printColumns = ($this->printColumns)
95  
-			? $this->printColumns
96  
-			: singleton($gridField->getModelClass())->summaryFields();
  94
+		if($this->printColumns) {
  95
+			$printColumns = $this->printColumns;
  96
+		} else if($dataCols = $gridField->getConfig()->getComponentByType('GridFieldDataColumns')) {
  97
+			$printColumns = $dataCols->getDisplayFields($gridField);
  98
+		} else {
  99
+			$printColumns = singleton($gridField->getModelClass())->summaryFields();
  100
+		}
  101
+		
97 102
 		$header = null;
98 103
 		if($this->printHasHeader){
99 104
 			$header = new ArrayList();

0 notes on commit 80feb8c

Please sign in to comment.
Something went wrong with that request. Please try again.