@@ -220,7 +220,7 @@ protected function buildExportColumn(array $row, array $columns)
220220 $ results = [];
221221 foreach ($ columns as $ column ) {
222222 if ($ column instanceof Column) {
223- if (! isset ( $ column [ ' exportable ' ]) || $ column ['exportable ' ]) {
223+ if ($ column ['exportable ' ]) {
224224 $ results [$ column ['title ' ]] = strip_tags (array_get ($ row , $ column ['name ' ]));
225225 }
226226 } else {
@@ -274,14 +274,47 @@ protected function getDataForPrint()
274274 $ decoratedData = $ this ->getAjaxResponseData ();
275275
276276 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 );
279279 }
280280
281281 return $ row ;
282282 }, $ decoratedData );
283283 }
284284
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+
285318 /**
286319 * Add basic array query scopes.
287320 *
0 commit comments