0

データベースが何も返さないときに列全体を非表示にしようとしていますが、それでもデータベース フィールド (例 {something}) を有効な入力として扱います。

$('#mytable th').each(function(i) {
  var remove = 0;

var tds = $(this).parents('table').find('tr td:nth-child(' + (i + 1) + ')')
tds.each(function(j) {
  if (this.innerHTML == '') remove++;
});
if (remove == ($('#mytable tr').length - 1)) {
  $(this).hide();
  tds.hide();
 }
});

https://jsfiddle.net/wwmyxp9o/9/

これは、現在の前面の外観です。

ここに画像の説明を入力

Stephen Walcherのコード remove/hide table's empty column(s) を含む <th>に基づいてこのコードを試しまし たが、まだ運がありません。

私はこの規模で何かを始めたばかりです。この問題の助けに感謝します。

ありがとう、

Z

4

1 に答える 1