From 1754ed87072a6dd0d962d180677962af0e49dd53 Mon Sep 17 00:00:00 2001 From: Joel Potter Date: Wed, 6 Sep 2017 13:13:38 -0400 Subject: [PATCH 1/2] Wrap response in table tag --- Griddly/Scripts/griddly.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Griddly/Scripts/griddly.js b/Griddly/Scripts/griddly.js index b5b983f..15f62c8 100644 --- a/Griddly/Scripts/griddly.js +++ b/Griddly/Scripts/griddly.js @@ -1194,16 +1194,16 @@ this.options.pageCount = Math.ceil(this.options.count / this.options.pageSize); // TODO: handle smaller count - var html = $(data); + var html = $("" + data + "
"); // replaceWith is more performant, but using inner html allows us to maintain the tbody element which is potentially important for some other libraries // https://github.com/programcsharp/griddly/issues/79 - this.$element.find("tbody.data").html(html.filter("tbody").html()); + this.$element.find("tbody.data").html(html.find("tbody").html()); var tfoot = this.$element.find("tfoot"); - if (tfoot.length && html.is("tfoot")) - tfoot.replaceWith(html.filter("tfoot")); + if (tfoot.length && html.find("tfoot").length) + tfoot.replaceWith(html.find("tfoot")); var startRecord = this.options.pageNumber * this.options.pageSize; this.$element.find(".griddly-summary").html(' ' + (startRecord + (this.options.count ? 1 : 0)) + ' - ' + (startRecord + currentPageSize) + " of " + this.options.count); From f56222eab0e5e88339af3ff9680a943025ebbce7 Mon Sep 17 00:00:00 2001 From: Joel Potter Date: Wed, 6 Sep 2017 13:15:59 -0400 Subject: [PATCH 2/2] Use children instead of find --- Griddly/Scripts/griddly.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Griddly/Scripts/griddly.js b/Griddly/Scripts/griddly.js index 15f62c8..ea9cb16 100644 --- a/Griddly/Scripts/griddly.js +++ b/Griddly/Scripts/griddly.js @@ -1198,12 +1198,12 @@ // replaceWith is more performant, but using inner html allows us to maintain the tbody element which is potentially important for some other libraries // https://github.com/programcsharp/griddly/issues/79 - this.$element.find("tbody.data").html(html.find("tbody").html()); + this.$element.find("tbody.data").html(html.children("tbody").html()); var tfoot = this.$element.find("tfoot"); - if (tfoot.length && html.find("tfoot").length) - tfoot.replaceWith(html.find("tfoot")); + if (tfoot.length && html.children("tfoot").length) + tfoot.replaceWith(html.children("tfoot")); var startRecord = this.options.pageNumber * this.options.pageSize; this.$element.find(".griddly-summary").html(' ' + (startRecord + (this.options.count ? 1 : 0)) + ' - ' + (startRecord + currentPageSize) + " of " + this.options.count);