Giter Club home page Giter Club logo

Comments (5)

johanneswilm avatar johanneswilm commented on August 25, 2024

Isn't that just the example data from the wiki [1] with the two numbers transformed from strings into numbers? If this is real data and a real issue you are having, can you not use the load functioned mentioned on that wiki page to transform those two numbers back into strings?

Please reopen if this doesn't work for you.

[1] https://github.com/fiduswriter/Simple-DataTables/wiki/ajax#example

from simple-datatables.

MartijnHarmenzon avatar MartijnHarmenzon commented on August 25, 2024

Thanks for the quick response. Yes, that's correct. It is the example to illustrate the issue we are having with our real data. Could you please explain why a number like 9958 is not shown and a number as a string "9958" is shown?

image

from simple-datatables.

johanneswilm avatar johanneswilm commented on August 25, 2024

Right. But as I said in my last response, there is a method to transform the data before using it. So there you transform it into a string. Typesafety is a good thing although in this case it's more coincidence.

from simple-datatables.

MartijnHarmenzon avatar MartijnHarmenzon commented on August 25, 2024

Ok. I understand. The load function might work, but because of the amount of data and the amount of numbers within the data it would not be our preferred way of doing it. It is also different from datatables.net. Therefore I would like to reopen this issue. I would also like to help or contribute if I would know how.

from simple-datatables.

johanneswilm avatar johanneswilm commented on August 25, 2024

The data conversion has to happen any way. There is no way you can make it faster by moving this code into Simple-DataTables, no matter how many numbers we are speaking of.

datatables.net is using what was common practice some 10 years ago when everything was relying upon jQuery. I assume that it automatically converts the data to a string. While that may seem convenient sometimes, it will quickly lead to all kind of problems when data is being auto converted like that. Read more about that for example here.

So I don't think we should switch to the behavior of datatables. But what could be done is adding an example to the wiki of how to do the type conversion for such cases. Also note that in some cases you may want to just convert it to a string directly, whereas in other cases you may want to take into account the length of the number so that sorting works out correctly. Otheerwise "900" will be after "1000" just because "9" is larger than "1".

At least that is my initial take. Maybe there could be a way of specifying the type of each field, but there is no way it can involve fewer calculations than just converting all the data in the function as described above.

from simple-datatables.

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.