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

Reorder Rows Example Does Not Show Ordered Data on getData Button #7618

Open
neilskilling-overskilling opened this issue Nov 20, 2024 · 1 comment
Labels
Bug Issues which are marked as Bug

Comments

@neilskilling-overskilling

Bootstraptable version(s) affected

1.23.5

Description

I am trying to get the onReorderRow event to fire and so I have gone back to the Reorder Rows example to see what I am doing wrong.

When I run the example and move a row around the getData alert just shows the ids in the original order. I thought that the idea of this example was to reorder the ids?

Also would be possible to add an example of onReorderRows event to this example as I can't get that to do anything. It may be related to the above issue.

I have tried changing line 28 to this:

$('#table').bootstrapTable({
    		onReorderRow: function(arg1, arg2, arg3) {
		       console.log(arg1, arg2, arg3)
    	   }
    }))

But it never gets called. I have three arguments here - the documentation states there are two arguments but lists three:

https://bootstrap-table.com/docs/extensions/reorder-rows/

Example(s)

https://live.bootstrap-table.com/example/extensions/reorder-rows.html is the original example

I copied that code to my own example: https://live.bootstrap-table.com/code/neilskilling-overskilling/18369 but this is just the same as the real example.

Possible Solutions

No response

Additional Context

No response

@neilskilling-overskilling neilskilling-overskilling added the Bug Issues which are marked as Bug label Nov 20, 2024
@borkowskizbigniew
Copy link

I had the same problem and after a few hours of searching I found the problem in the bootstrap-table.js code in the "initRow" method. Since version > 1.23.2 there have been changes that prevent rows reordering from working correctly.
I changed one line of code in "bootstrap-table/src/bootstrap-table.js:1536",
namely from
"id: Array.isArray(item) ? undefined : item._id,"
to
"id: attributes.id || (Array.isArray(item) ? undefined : item._id),
and rows reordering works again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Issues which are marked as Bug
Projects
None yet
Development

No branches or pull requests

2 participants