diff --git a/Griddly/Scripts/griddly.js b/Griddly/Scripts/griddly.js index b5b983f..ea9cb16 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.children("tbody").html()); var tfoot = this.$element.find("tfoot"); - if (tfoot.length && html.is("tfoot")) - tfoot.replaceWith(html.filter("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);