From 1062fb9ba6f1b7541bb822b0e509a5263df134e5 Mon Sep 17 00:00:00 2001 From: maparrar Date: Mon, 22 Feb 2016 11:02:09 -0500 Subject: [PATCH 1/2] Add attribute list in the result table --- dist/jquery.bootgrid.js | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/dist/jquery.bootgrid.js b/dist/jquery.bootgrid.js index 4f27d44..d9fe397 100644 --- a/dist/jquery.bootgrid.js +++ b/dist/jquery.bootgrid.js @@ -284,7 +284,9 @@ { row[column.id] = column.converter.from(cells.eq(i).text()); }); - + //Get the row attributes + var attr=stringAttributes($this); + row.attr=attr; appendRow.call(that, row); }); @@ -292,6 +294,19 @@ sortRows.call(this); } } + + /** + * Returns the element's attribute list in a string + * @param {element} element Row to check + * @returns {string} String with elements + */ + function stringAttributes(element){ + var string=""; + $(element[0].attributes).each(function() { + string+=' '+this.nodeName+'="'+this.nodeValue+'" '; + }); + return string; + } function setTotals(total) { @@ -596,7 +611,8 @@ var cells = "", rowAttr = " data-row-id=\"" + ((that.identifier == null) ? index : row[that.identifier]) + "\"", rowCss = ""; - + //Add attributes to the new row + rowAttr += row.attr; if (that.selection) { var selected = ($.inArray(row[that.identifier], that.selectedRows) !== -1), From 0bfcc328abeeef1510076eba08c52a6dea91c58d Mon Sep 17 00:00:00 2001 From: maparrar Date: Wed, 24 Feb 2016 17:00:45 -0500 Subject: [PATCH 2/2] Function to return all rows, another to select all at first --- dist/jquery.bootgrid.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/dist/jquery.bootgrid.js b/dist/jquery.bootgrid.js index d9fe397..ebf8a1b 100644 --- a/dist/jquery.bootgrid.js +++ b/dist/jquery.bootgrid.js @@ -1745,6 +1745,29 @@ { return $.merge([], this.currentRows); }; + + /** + * Returns all the rows + * @method getRows + * @returns {Array} All the rows + */ + Grid.prototype.getRows = function(){ + return $.merge([], this.rows); + }; + + /** + * Select all rows, even the invisible ones + * @method selectAllRows + */ + Grid.prototype.selectAllRows = function(){ + var that = this; + for(var i in this.rows){ + var row=this.rows[i]; + if(row.id!==undefined){ + that.select([row.id]); + } + } + }; /** * Gets a number represents the row count per page.