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

Allow drop on empty part of table #15

Closed
cvconover opened this issue Mar 12, 2014 · 8 comments
Closed

Allow drop on empty part of table #15

cvconover opened this issue Mar 12, 2014 · 8 comments
Milestone

Comments

@cvconover
Copy link

I thought it was not as intuitive to force the user to drop the first item at the very top on an empty table, so I made some mods that I think could improve the UX but I am not certain if there are any negative repercussions as I have not done extensive testing, yet, but so far it looks good. Here's what I did.

In I3DragBetweenHelper, I commented out lines 792 - 797 (if nil check on drop index)
https://github.com/ice3-software/i3-dragndrop/blob/master/Classes/I3DragBetweenHelper.m#L792

Then in the delegate method, droppedOnDstAtIndexPath:to fromSrcIndexPath:from, I check for index==nil and just create a new NSIndexPath with row set to the size of the datasource of the target table. I have to do the same in the srcTable as I did in the dstTable, obviously.

if (to == nil)
{
    to = [NSIndexPath indexPathForRow:(self.dstDataSource.count) inSection:0];
}

Hope this can make it into your sources as feature if you see it as useful.

@SteveFortune
Copy link
Member

Looks good. Please create a PR to the dev branch and I'll review and merge when I get a chance.

Before you PR, could you run through the Test App scenarios just to double check that it doesn't cause any issues?

Thanks!

@cvconover
Copy link
Author

Will do. I'll have to follow up on this over the next several days but I will run the tests.

@cvconover
Copy link
Author

Made significant progress on this tonight. More to do than I thought but should have it solid for all Test app scenarios soon.

@SteveFortune
Copy link
Member

See issues with #18

@pboushy
Copy link

pboushy commented May 1, 2014

Hi Steve and Craig, I'm currently using this library in one of my apps and looking forward to having this functionality. Is there anything I could assist with to help implement this?

@SteveFortune
Copy link
Member

Hi @prbsparx, check out Craig's PR. If you want to move this issue along, it would be very helpful if you could review and try to resolve the issues that I've highlighted in the comments. I'd me happy to merge it into the next release if we can make it more stable. :)

@SteveFortune
Copy link
Member

Proposing the following algorithm for coordination on drag stop, which should resolve this and #34:

  • If data source says delete at this drop origin
    • Delete
  • Else if stop drag on collection && if drag stopped on same collection as origin && valid item at drop origin && data source says rearrangeable
    • Rearrange
  • Else if drag stopped on different collection
    • If the data source says we can exchange the items at the given points in these collections && there is a valid item in the target collection
      • Exchange
      • Note that the coordinator assumes that if the data source says ‘yes’ but there is no valid item in the target collection, that the data source is wrong. Advantage here is that we’re safeguarding the user against violating integrity constraints
    • Else if the data source says that we can append the item onto the target collection
      • Append
      • Note that here we don't check whether there isn't a valid item at the drop origin. This is because a user may want to configure drops across the whole of a collection to be appendations not exchanges. Appending items only if the drop origin allows and there is no item at that point in the collection is too opinionated.
    • Else
      • Reset
  • Else
    • Reset

SteveFortune added a commit that referenced this issue Nov 21, 2014
@SteveFortune
Copy link
Member

We need to change the render delegate protocol as well to offer methods for rendering both appendation and exchanging.

SteveFortune added a commit that referenced this issue Nov 21, 2014
… Build failing due to BC breakage of the data source protocol
SteveFortune added a commit that referenced this issue Nov 21, 2014
SteveFortune added a commit that referenced this issue Nov 21, 2014
…te tests and seems as though all of the refactored coordinator tests pass again - going to backwards test them now
SteveFortune added a commit that referenced this issue Nov 21, 2014
… if we drop on a valid droppable collection
SteveFortune added a commit that referenced this issue Nov 22, 2014
… the delete drag data source methods to be more expressive of the fact that deletion can occur at any point in the arena
SteveFortune added a commit that referenced this issue Nov 22, 2014
SteveFortune added a commit that referenced this issue Nov 22, 2014
…xchange / append methods and used a shared behaviour to test both new methods
SteveFortune added a commit that referenced this issue Nov 22, 2014
… as exchanging. @cvconover Looks like we finally have this in place for v2.
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

No branches or pull requests

3 participants