- Notifications
You must be signed in to change notification settings - Fork 431
Add react-bootstrap-table2-drag #673
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
base: feat/dnd
Are you sure you want to change the base?
Add react-bootstrap-table2-drag #673
Conversation
I just realized the last 2 of those issues were asking for column resorting. This PR is aimed at adding the ability to drag/drop rows and call a callback that allows you to update the order of your data. However this does put a lot of the base work into making column re-ordering possible, so it wouldn't be too hard to add that in. |
@jehartzog soooo coool, I will have a look into this when I have time, thanks your contribution :) |
@AllenFang Thanks. I'm not 100% done with it, but the basic framework is there with a fully functional example. Since it's a pretty big feature addition (full new plugin) I would like your feedback before I continue working on it. I tried to copy the style/usage that you already used in RBST2, but it was a little challenging to follow how everything fit together from just reading source. I do like how you dynamically create context based on the plugins/props being used, but the actual method to do that involves a lot of different parts working together, and not having done something like that myself it was slow going to replicate. |
@jehartzog sure, I think you already made a good contribution, I will spend some time and give u some feedback, in this period, you can just have a rest haha. |
Has this feature been added ? If yes could you provide an example on how to use it ? Thanks a lot :) |
@rohankk2 Fork the branch and load the storybook, an example was provided with the PR. It has not yet been merged into the main project, so if you can't wait then you will need to run off a forked version. Also be aware this is basically a draft version so the interface/functions may change before the final version 😬 |
i am also waiting for an example, please provide so i can integrate |
hi all, I will look into this PR in this weekend and hope we can release in next week if everything is ok ;) Sorry for lately review |
No problem, I'll be around this weekend so should be able to respond quickly. For those peeps asking for example, please read this comment, the PR has a full example included. |
@jehartzog may I ask u a question, when I try the dnd story, how do it work? I tried drag lots of times, but it's not work lol |
@AllenFang For now all it does is log the to/from indexes to console, I didn't actually add the logic for re-ordering or other features, as I wanted to make sure to establish the more general API before adding more features. |
@AllenFang I just added an example of how I used re-ordering for my project. Also I added another item on todo list, on my project I implemented |
that's good. For me, there's a functionality question: In this design, user can only drag via a cell/column, is it possible to reorder by drag on row? |
base = this.renderWithFilterCtx(base, baseProps); | ||
} | ||
| ||
if (this.DragContext) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the context order is important. please move to Line 274
The important thing here for the order of constructing context is about the whether a context change raw data or not, so you see: CellEdit, Filter, Search, Sort and Pagination, these context must change raw data in different perspective. Therefore, we need to wrap these context firstly,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this going to be merged into the project?
In my own project, I wrapped the entire row as a generic drag target, just as you mentioned it's much better for usability. I don't know offhand how to do this with a RBST2 plugin approach but will look into it. |
@jehartzog, yes, I think we can support reorder the row by column or row :) btw, I'm not very familiar dnd. what's the different for |
Check out this for an example of what it can do. While the example is simple, it easily supports animating entire rows with minimal lag. There is a performance penalty when you get into large number of rows, which is why it should be optional. But for most use cases people will want to have it. |
I see, feel free to add |
@AllenFang I started playing with it, adding the animations should be a different PR since I have to make a number of edits to the core package. This is because in order for the animations to work, you need to wrap the entire row in a |
@jehartzog sure, I think it's time to open a branch for working on these stuffs. Let me create it and let's switch these PRs to it. |
let's go for |
@padronlv We are using this functionality in production and it works nicely. Most of the code to get it working is already in this PR, thanks for reminding me to take another look at it. I'll review it since it's been a few months and ask for it to be merged once I'm sure it's in a working state. |
I am using this library in a project, and this feature would be quite useful for me. Any news here? |
i want to use drag and drop inside column in this react bootstrap please help me as soon as posibile |
i need to add drag and drop in column. not able to implemant. please help me out of thsi problem |
@AllenFang Any particular reason that this PR is not merged into the master branch? |
It was fully functional back when I was adding this to our app, since then it's been working great in our production app. A couple weeks ago I checked out the branch to see if the examples still worked, and saw they were broken for some reason. I'd be happy to update them so they work again, but would like to hear that somebody who can review & merge is watching so that the contribution actually gets used 😁 . |
@jehartzog Thanks for your response. I moved on to use snapify to drag and drop by grid rows. I use react-bootstrap-table-next heavily in my project for its convenient sorting, filtering and pagination capabilities. It would be great if you can integrate this feature in that library. |
@jehartzog i want to use column reordering (Drag and Drop) in react-bootstrap-table. Please help me out of this problem. Thank You |
Hi any updates on this? This feature would be really helpful for my company. |
I just downloaded and fired up the Drag and Drop example in Storybook. No errors in the console, but the rows don't seem to be draggable. Could I be missing a step? Also, maybe we could take up a bounty for you guys to integrate this? I would happily chip in. |
Back when I did this, I believed that this branch was working just fine. I don't know what changed, or perhaps I was somehow using a stale I switched gears and checked back to the production app that has been using this successfully for a year+ now, and realized that I'd really like to get this merged in, and will help clean it up and get it caught up to GIF for proof 😀 : |
Hello @jehartzog . I want to test and run this drag feature but I am a bit confused about how to do it. I forked this branch as you mentioned here #673 (comment) but I don't know how to run. Can you please give me some more detailed info on how to run it locally on my PC? |
Run |
Are there any plans to make this part of the main library? |
Not Found - GET https://registry.npmjs.org/react-bootstrap-table2-drag - Not found when trying to install the module |
Same issue as above,
|
What's the current status/roadmap for this? Is it supposed to be working? @jehartzog @AllenFang |
@amitsetty You need to install from directly from github if you want to use this. I've offered many times to get this merged in to main repo, but no response from owner in years. |
just npm install the github branch and use that? @jehartzog |
Hello, It's very useful feature, is there any plan to merge this branch ? thanks |
Wishing we had this feature -- especially for column re-ordering! |
@AllenFang I see there hasn't been a new release since May 31 and 30 PR's currently open. Do you have a plan to get more maintainers or hand this project off? Do others have write access to the repo? |
@jehartzog Could I please trouble you for a short working code? Your storybook example seems to specify |
@Unforgiven-wanda #673 (comment) |
As requested in #193, #665, and #493 (and also requested for RBST1).
The API isn't final, but it currently works where it will issue your callback with the
fromIndex
andtoIndex
, allowing you to mutate the data and pass updated data to RBST2.Looking for some feedback/guidance before I finish this up.
Possible/needed improvements:
hover
handler that has RBST2 internally re-order the rows based where the row is being dragged to.- [ ] Add optional re-order animation usingreact-flip-toolkit