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

"getColumnLayout" is not support columnMoved in "Column Grouping" #2461

Closed
yiunsr opened this issue Oct 29, 2019 · 2 comments
Closed

"getColumnLayout" is not support columnMoved in "Column Grouping" #2461

yiunsr opened this issue Oct 29, 2019 · 2 comments
Labels
Bug Bug awaiting resolution

Comments

@yiunsr
Copy link

yiunsr commented Oct 29, 2019

Describe the bug

  • "getColumnLayout" function does not work properly after executing moveColumn function.
  • This happens only when the order is changed within a column group.

Tabulator Info

  • 4.4.3
var tabledata = [
 	{id:1, name:"Oli Bob", age:"12"},
 	{id:2, name:"Mary May", age:"1"},
 	{id:3, name:"Christine Lobowski", age:"42"},
 ];

var tabulator = new Tabulator("#table", {
	movableColumns: true,
  layout:"fitColumns",
  data:tabledata,
	columns:[
  	{title:"id", field:"id"},
    {title:"user info", field:"group", columns:[
    	{title:"name", field: "name"},
      {title:"age", field: "age"}
    ]},
	] 
});

Working Example
https://jsfiddle.net/nahanmil/xzk5rohm/17/

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://jsfiddle.net/nahanmil/xzk5rohm/17/
  2. Click on "subcolumnMove" button (It make name and age column swap)
  3. Click on "getColumnLayout" button
  4. See getColumnLayout function result
Error result
[{"title":"id","field":"id","width":213,"visible":true},
{"title":"user info","columns":
    [{"title":"name","field":"name","width":213,"visible":true}, 
    {"title":"age","field":"age","width":213,"visible":true}]}]

Expected behavior

success result
[{"title":"id","field":"id","width":213,"visible":true},
{"title":"user info","columns":
    [ {"title":"age","field":"age","width":213,"visible":true},
    {"title":"name","field":"name","width":213,"visible":true}]
]

Additional context
'ColumnManager.prototype.moveColumnActual' function something wrong.
Should change sub column order.

ColumnManager.prototype.moveColumnActual = function (from, to, after) {
    // Do something special for Column Grouping.
    if(from.parent.isGroup && from.parent == to.parent){
        this._moveColumnInArray(from.parent.columns, from, to, after);
    }
    else{
        this._moveColumnInArray(this.columns, from, to, after);
    }

    this._moveColumnInArray(this.columnsByIndex, from, to, after, true);
               ......
@olifolkerd olifolkerd added the Bug Bug awaiting resolution label Nov 6, 2019
@olifolkerd
Copy link
Owner

olifolkerd commented Nov 6, 2019

Hey @yiunsr

Thanks for the headsup, i will make sure a fix for this goes in one of the next releases.

Cheers

Oli :)

@olifolkerd
Copy link
Owner

Hey @

I have just pushed a fix for this to the 4.6 branch, which will be released later this weekend.

Cheers

Oli :)

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

No branches or pull requests

2 participants