It turns out I wasn’t able to hide the column with the single line, but if I embed the property in an if/else, inside a function… then it works fine. Seems counter-intuitive as I might not want to run another function, but it is what it is.
I’ve updated the above codepen with the solution to this: View Codepen
//hiding a column or two
var adaptivewidth = function () {
if (window.innerWidth < 768) {
$("#jqxgrid").jqxGrid("hidecolumn", "phone");
$("#jqxgrid").jqxGrid("hidecolumn", "hireDate");
} else {
$("#jqxgrid").jqxGrid("showcolumn", "phone");
$("#jqxgrid").jqxGrid("showcolumn", "hireDate");
}
};
//allows the above function to run whether window is loaded or resized
["load", "resize"].forEach((e) =>
window.addEventListener(e, adaptivewidth, false)
);