@@ -220,7 +220,7 @@ protected function buildExportColumn(array $row, array $columns)
220
220
$ results = [];
221
221
foreach ($ columns as $ column ) {
222
222
if ($ column instanceof Column) {
223
- if (! isset ( $ column [ ' exportable ' ]) || $ column ['exportable ' ]) {
223
+ if ($ column ['exportable ' ]) {
224
224
$ results [$ column ['title ' ]] = strip_tags (array_get ($ row , $ column ['name ' ]));
225
225
}
226
226
} else {
@@ -274,14 +274,47 @@ protected function getDataForPrint()
274
274
$ decoratedData = $ this ->getAjaxResponseData ();
275
275
276
276
return array_map (function ($ row ) {
277
- if (is_array ( $ this ->printColumns )) {
278
- return array_only ($ row , $ this -> printColumns );
277
+ if ($ columns = $ this ->printColumns ( )) {
278
+ return $ this -> buildPrintColumn ($ row , $ columns );
279
279
}
280
280
281
281
return $ row ;
282
282
}, $ decoratedData );
283
283
}
284
284
285
+ /**
286
+ * Get printable columns.
287
+ *
288
+ * @return array|string
289
+ */
290
+ protected function printColumns ()
291
+ {
292
+ return is_array ($ this ->printColumns ) ? $ this ->printColumns : $ this ->getColumnsFromBuilder ();
293
+ }
294
+
295
+ /**
296
+ * Build printable column.
297
+ *
298
+ * @param array $row
299
+ * @param array|Column[] $columns
300
+ * @return array
301
+ */
302
+ protected function buildPrintColumn (array $ row , array $ columns )
303
+ {
304
+ $ results = [];
305
+ foreach ($ columns as $ column ) {
306
+ if ($ column instanceof Column) {
307
+ if ($ column ['printable ' ]) {
308
+ $ results [$ column ['title ' ]] = array_get ($ row , $ column ['name ' ]);
309
+ }
310
+ } else {
311
+ $ results [] = array_get ($ row , $ column );
312
+ }
313
+ }
314
+
315
+ return $ results ;
316
+ }
317
+
285
318
/**
286
319
* Add basic array query scopes.
287
320
*
0 commit comments