Skip to content

Commit

Permalink
Do not allow hide column on primary keys, refs #615
Browse files Browse the repository at this point in the history
  • Loading branch information
simonw committed May 24, 2021
1 parent a0234fc commit c22f291
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion datasette/static/table.js
Expand Up @@ -120,7 +120,12 @@ var DROPDOWN_ICON_SVG = `<svg xmlns="http://www.w3.org/2000/svg" width="14" heig
} else {
showAllColumns.parentNode.style.display = "none";
}
hideColumn.setAttribute("href", hideColumnUrl(column));
if (th.getAttribute("data-is-pk") != "1") {
hideColumn.parentNode.style.display = "block";
hideColumn.setAttribute("href", hideColumnUrl(column));
} else {
hideColumn.parentNode.style.display = "none";
}
/* Only show facet if it's not the first column, not selected, not a single PK */
var isFirstColumn =
th.parentElement.querySelector("th:first-of-type") == th;
Expand Down

0 comments on commit c22f291

Please sign in to comment.