question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Overriding sorting behavior

See original GitHub issue

Hi @JakeSidSmith, sorry, I forgot to create an issue to continue our discussion in #71 but here it is now 😃

To recap, in my use case, if a user drops an item in between others, it sorts the list but if the item is dropped on top of another, I can perform a different operation. So, to do this, I would need to know if an item is dropped on top of another ( or within certain boundaries of the new item and then not calculate new position in this case), or above or below the other (calculate new position in this case).

So, as I see it, the cleanest way, in terms of API might look something like this -

  1. A prop, lets say sortZoneLimitPercent passed to Reorder that indicates what % area of the item to limit the dropzone to. So, by default, today that is 100%. If it is passed as 60, that means the top and bottom 20% of the item would not be considered as 'sortZone`.

  2. An additional prop added to onReorder and onReorderGroup callback that indicates whether the item was dropped within the boundaries of an item, or outside, i.e. if sortZone is true or not.

Thoughts?

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
JakeSidSmithcommented, Aug 24, 2017

@oyeanuj you’d set the data attribute on an element inside one of your items, and then it’d check for that, and check for collisions against that element, rather than the root node of an item.

1reaction
champengcommented, May 3, 2017

If it is passed as 60, that means the top and bottom 20% of the item would not be considered as 'sortZone`.

@oyeanuj I think passing 60 would mean that top and bottom 30% would be the only place for sorting the list i.e. top and bottom 30% should be considered as sortZone and middle 40% would be considered for drop over existing element.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Overriding Sorting Behaviour - Forums - Infragistics
When a user clicks on a column header I want to be able to specify my own behaviour/method, when have a web service...
Read more >
Is there a way to override the default sorting behavior in JQGrid?
I'm using JQGrid 4.4.0 and I would like to override the default behavior for how integers are sorted. I can achieve this by...
Read more >
Scripting API: Canvas.overrideSorting - Unity - Manual
Override the sorting of canvas. Allows for nested canvas's to ignore the parent draw order and draw ontop or below. Did you find...
Read more >
Use Custom Sorting - IBM
You can use the custom sort options to override the default sorting behavior. For example, you can sort items based on a measure...
Read more >
Overriding Sort Specifications on Business Components
The All Mode Sort user property overrides the default sort specification that a business component contains. It can contain one of the following...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found