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

Sort Breaks with mixed data #17

Closed
ebini opened this issue Feb 7, 2022 · 3 comments
Closed

Sort Breaks with mixed data #17

ebini opened this issue Feb 7, 2022 · 3 comments

Comments

@ebini
Copy link

ebini commented Feb 7, 2022

Hi,

i really appreciate your javascript.

i have a table with a column which has numbers and - the String "N/A" if i got no data.
The sorting seems to "break":

<!DOCTYPE html>
<html>

<head>
    <link rel="stylesheet" type="text/css" href="./dist/jstable.css">
    <script type="text/javascript" src="./dist/jstable.min.js"></script>
    <script type="text/javascript" src="./dist/jstable.es5.min.js"></script>
    <script type="text/javascript" src="./dist/polyfill-fetch.min.js"></script>
</head>

<body>
    <table id="myTable">
        <thead>
            <tr class="header">
                <th>Test</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td>0</td>
            </tr>
            <tr>
                <td>15</td>
            </tr>
            <tr>
                <td>N/A</td>
            </tr>
            <tr>
                <td>0</td>
            </tr>
            <tr>
                <td>7</td>
            </tr>
            <tr>
                <td>33</td>
            </tr>
            <tr>
                <td>N/A</td>
            </tr>
            <tr>
                <td>2</td>
            </tr>
            <tr>
                <td>0</td>
            </tr>
        </tbody>
    </table>
    <script>
        let myTable = new JSTable("#myTable");
    </script>
</body>

</html>

so it starts sorting, until it seems to hit a "N/A" and then start again sorting.

can this be fixed (or have i used this js wrong?)

Thanks

Best regards

@Trekky12
Copy link
Collaborator

Trekky12 commented Feb 9, 2022

Hey @ebini,

thank you for your feedback.
So first you don't need to include both javascript files jstable.min.js and jstable.es5.min.js. Only one file is needed. If you support current browsers you can just use the jstable.min.js. The file jstable.es5.min.js is only needed for compatibility with browsers that don't support current ES6 features.

I checked your example (and everything is used correct) and apparently there is indeed a problem with mixed data in some browsers, Chrome for example is working fine but Firefox has the issue which you described.
I will try to fix this as soon as possible.

Best regards

@Trekky12
Copy link
Collaborator

Trekky12 commented Feb 9, 2022

@ebini Could you please try the new version 1.5.1?

@ebini
Copy link
Author

ebini commented Feb 10, 2022

Thanks it is working now!
I'm very thankful!

@ebini ebini closed this as completed Feb 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants