Skip to content

Commit

Permalink
Fix issue with non array values
Browse files Browse the repository at this point in the history
  • Loading branch information
agustinbusso committed Jun 12, 2024
1 parent 76369d4 commit f0f9df2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions resources/js/components/common/mixins/datatable.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ export default {
// Some controllers return each row as a json object to preserve integer keys (ie saved search)
jsonRows(rows) {
if (rows.length === 0 || !(_.has(_.head(rows), "_json"))) {
if (!Array.isArray(rows) && typeof rows === "object") {
return Object.values(rows);
}
return rows;
}
return rows.map((row) => JSON.parse(row._json));
Expand Down

0 comments on commit f0f9df2

Please sign in to comment.