Probably a class extension that auto-mix()es onto Y.DataTable
The implementation I'm thinking of involves adding a <style> block in the contentBox with dynamically generated rules that apply display: none based on the cascade. All cells, including header cells, would need to be stamped with a column-specific class, allowing, e.g.
Thus hiding or showing a column would involve boundingBox.addClass(<hide class>) or removeClass(...).
Caveats:
Not all columns have keys, some just formatters - complicates using column classes based on key
The same column can appear in the columns list multiple times - complicates using column classes based on key
Columns can be moved - complicates using classnames based on column position
Nested headers will need to have their colspans adjusted.
Since hidden cells will still be in the DOM, this will impact memory and render time.
The <style> must be replaced wholesale if columns are added. It doesn't need to be changed if columns are moved or deleted. Replacing the <style> will trigger a page reflow, so should be avoided.
Probably a class extension that auto-mix()es onto
Y.DataTable
The implementation I'm thinking of involves adding a
<style>
block in thecontentBox
with dynamically generated rules that applydisplay: none
based on the cascade. All cells, including header cells, would need to be stamped with a column-specific class, allowing, e.g.Thus hiding or showing a column would involve
boundingBox.addClass(<hide class>)
orremoveClass(...)
.Caveats:
key
s, some just formatters - complicates using column classes based onkey
columns
list multiple times - complicates using column classes based onkey
colspan
s adjusted.The
<style>
must be replaced wholesale if columns are added. It doesn't need to be changed if columns are moved or deleted. Replacing the<style>
will trigger a page reflow, so should be avoided.