10 examples of 'how to get row data of html table using jquery' in JavaScript

Every line of 'how to get row data of html table using jquery' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
10function get_row($row){
11 var counter = $row.attr('data-counter');
12 var row = rows[counter];
13 if (row){
14 return row;
15 }
16 var $modal = $row.parent().parent().parent();
17 row = {
18 counter: counter,
19 $row: $row,
20 $modal: $modal,
21 $submit: $modal.find('button[type="submit"]'),
22 show_msg: function (msg, color){
23 var $msg = $('<span>').html(msg);
24 if (color){
25 $msg.css('color', color);
26 }
27 this.$row.find('.message').html('').append($msg);
28 },
29 block: function(){
30 this.$row.find('input,select').not('.email').attr('disabled', 1);
31 this.$row.addClass('blocked');
32 this.$submit.attr('disabled', '1');
33 },
34 disable_known_field: function(field){
35 this.$row.find('[name=' + this.counter + '-' + field + ']').attr('disabled', 1);
36 },
37 reset: function(){
38 // remove message and restrictions
39 this.$row.find('input,select').removeAttr('disabled');
40 this.$row.find('.message').html('');
41 this.$row.removeClass('blocked');
42 if (!this.$modal.find('.row.blocked').length){
43 this.$submit.removeAttr('disabled');
44 }
45 }
46 };
47 rows[counter] = row;
48 return row;
49}</span>
34getRowsForDataTable(data) {
35 return data;
36}
27function getCellValue(row, index){
28 return $(row).children('td').eq(index).html();
29}
3function buildTable(tableId, jdata) {
4 var elTable = jQuery("#" + tableId);
5 var columns = addColumnHeaders(elTable, jdata);
6 var tbody = elTable.find("tbody");
7 if (tbody.length === 0) { //if there is no tbody element, add one.
8 tbody = jQuery("<tbody></tbody>").appendTo(elTable);
9 }
10 for (var i = 0; i &lt; jdata.length; i++) {
11 var row$ = $('<tr>');
12 for (var colIndex = 0; colIndex &lt; columns.length; colIndex++) {
13 var cellValue = jdata[i][columns[colIndex]];
14 var tdClass = "col r" + i + "c" + colIndex;
15 if (cellValue == null) {
16 cellValue = "";
17 }
18 row$.append($('<td>').html(cellValue).addClass(tdClass));
19 }
20 tbody.append(row$);
21 }
22}</td></tr>
28function getCellValue(row, index){
29 var out = '';
30 if ($(row).children('td').eq(index).find('img').length != 0) {
31 out = $(row).children('td').eq(index).find('img').attr('alt');
32
33 } else if($(row).children('td').eq(index).find('a').length != 0){
34 out = $(row).children('td').eq(index).find('a').text();
35 } else {
36 out = $(row).children('td').eq(index).html();
37 }
38 return out;
39}
538function renderTable(table) {
539 $(table).handsontable("render");
540 // Yet another dirty hack to solve HandsOnTable problems
541 if (parseInt($(table).css("height"), 10) &lt; parseInt($(table).css("max-height"), 10) - 30) {
542 $(table).find(".ht_master .wtHolder").css("height", "100%");
543 }
544}
115function utils_GetTableSelectedRow(tableId) {
116 var rows = $("#" + tableId).find("tr").not(":first");
117 var index = utils_GetTableSelectedRowIndex(tableId);
118 if (index == -1) {
119 return null;
120 }
121 return rows[index];
122}
7function refreshTableRows(table, data) {
8 var tbody = table.find('tbody');
9 // Clear rows
10 tbody.empty();
11
12 // Append all rows
13 $.each(data, function () {
14 var row = '<tr>';
15
16 for (var key in this) {
17 var val = this[key];
18 row += '<td>' + val + '</td>';
19 }
20
21 row += '<td>-</td></tr>';
22 tbody.append(row);
23 });
24
25}
200function selectRows(jq) {
201 return $.map(selectRowsArray(jq), function(row) { return cells2Jq(row.cells); });
202}
538function getColHtml(
539 table, data, field, rowIndex, fieldIndex, extraArgs
540) {
541 var fieldEditable = field.editable;
542 if ('function' == typeof fieldEditable) {
543 fieldEditable = fieldEditable.call(table, data, rowIndex, fieldIndex, extraArgs);
544 }
545 var iconClass = table.helper.getIconClass();
546 if (table.editable &amp;&amp; fieldEditable) {
547 return {
548 textClass: table.getClass('cell-editable'),
549 html: lib.format(
550 editentryTpl,
551 {
552 className:
553 table.getClass('cell-editentry')
554 + ' '
555 + iconClass,
556 row: rowIndex,
557 col: fieldIndex
558 }
559 )
560 };
561 }
562}

Related snippets