glittershark / reactable

Fast, flexible, and simple data tables in React
glittershark.github.io/reactable
MIT License
1.51k stars 222 forks source link

Column Order changes when Sorting #145

Open mklauber opened 9 years ago

mklauber commented 9 years ago

I'm having a strange issue. Essentially, whenever I sort a column, the order of the columns changes. I've cut my app down to the the simplest code I can and I still get this behavior. Am I missing something?

<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv='Content-type' content='text/html; charset=utf-8'>
    <title>Basic Example with External JSX</title>
    <style>
        table: { width:100%;}
    </style>
  </head>

  <body id='body'>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.12.2/JSXTransformer.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.12.2/react-with-addons.js"></script>
    <script src="reactable.js"></script>
    <script type="text/jsx">
        var Table = Reactable.Table;
React.render(
    <Table className="table" sortable={true} data={[
        { Name: 'Griffin Smith', Age: 18 },
        { Age: 23,  Name: 'Lee Salminen' },
        { Age: 28, Position: 'Developer' },
    ]} />,
    document.getElementById('body')
);
    </script>

  </body>
</html>
glittershark commented 9 years ago

This definitely sounds like a bug to me. Does it happen when you manually specify the columns in an array?

mklauber commented 9 years ago

No it does not. Thanks.

glittershark commented 9 years ago

Alright - that's a temporary workaround, but this is still definitely a bug.

brandonros commented 9 years ago

Can confirm the example code listed right on the site (the data boasting the ability to omit certain columns for certain rows) is guilty of this

Aknilam commented 8 years ago

+1 http://plnkr.co/edit/vvlR6a?p=preview

banderson5144 commented 8 years ago

Any update on this?

singpolyma commented 8 years ago

Can confirm this also. It seems like maybe not a problem for real data, but is disconcerting that the example from the readme acts in a broken way

zackharley commented 8 years ago

I'm also having this issue.

skix123 commented 8 years ago

Are you planning any updates?

mnbucher commented 8 years ago

Any updates here? I'm also having this issue...

mohdhazwan commented 7 years ago

anyone found the solution please share.

thanks

ngocgiang2512 commented 7 years ago

I'm also in trouble with it,