Skip to content

Instantly share code, notes, and snippets.

@srph
Created September 12, 2014 04:18
Show Gist options
  • Select an option

  • Save srph/aa3fc76dab30968428e5 to your computer and use it in GitHub Desktop.

Select an option

Save srph/aa3fc76dab30968428e5 to your computer and use it in GitHub Desktop.
Here's a summary of my implementation. Everything is through data-binding which seems to be non-performant.
- Each column has the button to hide column
- Each column is hidden if it is found in the array of hidden columns
- When it is clicked, it added to the array of hidden columns
- To show it back, I have a <select> (Default value is ''). When its value changes with ng-change, it removes the column in the array of hidden column.
Here's my idea
To hide:
- I have a directive called "hide-column"
- It accepts two parameters (<button hide-column label="Name" nth-column="1">), Label of the column, the nth column to be hid.
- It has a link function; when it is clicked, it hides ths and tds of nth (where n is the position of the column; or its position in its DOM tree[e.g., 1st column is 1])
- Then, since the link can access the controller, we will update the array of hidden columns in the controller to be used in the <select> tag or list of hidden columns.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment