Coder Social home page Coder Social logo

Columns are jumbled about rhandsontable HOT 6 CLOSED

jrowen avatar jrowen commented on June 29, 2024
Columns are jumbled

from rhandsontable.

Comments (6)

jrowen avatar jrowen commented on June 29, 2024

Thanks for posting. The hand off between rhandsontable and htmlwidgets isn't working as expected, so I've posted an issue with that project as well.

from rhandsontable.

timelyportfolio avatar timelyportfolio commented on June 29, 2024

I think changing this line to be explicit and follow ordering specified by x.colHeaders will be a more robust way to handle.

toArray(x.data.map(function(d){return x.colHeaders.map(function(ky){return d[ky]})}))

from rhandsontable.

jrowen avatar jrowen commented on June 29, 2024

Thanks, your suggestion fixes the problem and is more robust.

It appears to me that the column reordering is happening outside of the toArray call, as in the js debugger I see the x.data obj passed to toArray already has an incorrect order. It seems that js is reordering the obj values.

> x.data[0]
<- Object {4: 1, 6: 3, 8: 14, vs: 0}

Just trying to understand why this is occurring so I can prevent future bugs. Thanks again for the help.

from rhandsontable.

timelyportfolio avatar timelyportfolio commented on June 29, 2024

I should in bold say I am not a definitive source but I recall seeing in multiple places that order of keys is not assured in JavaScript objects. Here is one StackOverflow post that seems to be more authoritative than me.

from rhandsontable.

jrowen avatar jrowen commented on June 29, 2024

Thanks for the link. I checked in a fix, but please re-open if you still run into issues.

from rhandsontable.

ramnathv avatar ramnathv commented on June 29, 2024

If I remember correctly, the reordering occurs only when the keys are numbers.

from rhandsontable.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.