Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Draggable Columns #258

Merged
merged 3 commits into from
Nov 9, 2016
Merged

[FEATURE] Draggable Columns #258

merged 3 commits into from
Nov 9, 2016

Conversation

offirgolan
Copy link
Collaborator

@offirgolan offirgolan commented Nov 9, 2016

Resolves #46.

Allows reordering of columns via drag n drop.

Column Properties

/**
 * Whether the column can be reorder via drag and drop.
 *
 * CSS Classes:
 *  - `is-draggable`
 *  - `is-dragging`
 *  - `is-drag-target`
 *    - `drag-left`
 *    - `drag-right`
 *
 * @property draggable
 * @type {Boolean}
 * @default false
 */
draggable: false

/**
 * Whether the column is a valid drop target.
 *
 * @property droppable
 * @type {Boolean}
 * @default true
 */
droppable: true

Header & Footer Actions

/**
 * onColumnDrag action.
 *
 * @event onColumnDrag
 * @param  {Column} column The column that is being dragged
 */
onColumnDrag(column) {}

/**
 * onColumnDrop action.
 *
 * @event onColumnDrop
 * @param  {Column} column The column that was dropped
 * @param  {Boolean} isSuccess The column was successfully dropped and sorted
 */
onColumnDrop(column, isSuccess) {}

@offirgolan offirgolan merged commit 548cbf4 into master Nov 9, 2016
@offirgolan offirgolan deleted the draggable-columns branch November 9, 2016 01:54
offirgolan added a commit that referenced this pull request Nov 14, 2016
* master: (24 commits)
  chore(package): update ember-wormhole to version 0.5.1 (#261)
  Update changelog
  Released v1.6.0
  [FEATURE] Draggable Columns (#258)
  chore(package): update ember-cli-code-coverage to version 0.3.8 (#257)
  Resizable column fixes (#252)
  fix: repeated scrollToRow (#254)
  chore(package): update ember-cli-code-coverage to version 0.3.7 (#253)
  Demo Cleanup (#251)
  chore(package): update ember-lodash to version 0.0.11 (#245)
  chore(package): update ember-cli-code-coverage to version 0.3.6 (#249)
  Document `Row#content` (#250)
  Update resizable snippet
  Released v1.5.2
  [FEATURE] minResizeWidth + Event bubbling fix (#244)
  Update readme
  Update readme
  Released v1.5.1
  Add safe checks scroll logic (#241)
  [DOCFIX] Make breakpoints of demo app the same as ember-responsive's default (#240)
  ...
@vasilakisfil
Copy link

@offirgolan is there a way we can get the column that received the drop ?

@offirgolan
Copy link
Collaborator Author

@vasilakisfil Not sure I follow. If you want to get the change of index, you can do that by getting the original column's position from onColumnDrag and the final position from onColumnDrop.

@vasilakisfil
Copy link

@offirgolan I get the same column (the one I drag) on both onColumnDrag and onColumnDrop. Should I get a different column ?

@offirgolan
Copy link
Collaborator Author

Nope it will be the same column. The actions exist so you can check the state of the column before and after it has been repositioned.

You can do something like:

table.get('columns').indexOf(column);

To get the before and after index.

@vasilakisfil
Copy link

ah ok cool I will try that. I think it would be nice if we got both column on the onColumnDrop event.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants