DataTables / DataTables/Plugins

Custom function stops with pagination + sort/order are not working properly

Open
#391 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
1.1k
Forks
1.7k
PR merge metrics
No merged PRs in 30d

Description

Hi !
I am having some trouble using the tabulator for the last couple of days and I was wondering if you guys can help me out?

From what I can tell is that the function I made "works", however, it seems like it stops whenever the table hits the next page (in the screenshot you will see what I exactly mean). Also, for some reason when the column is order by number it looks like the column looks at the first "big" number which is a 9 and ignores the 2nd digit (e.g. 27 which is also visible in the graph --> temperature column). I did look into the extended plugin, with no success.

`
jQuery.extend(jQuery.fn.dataTableExt.oSort, {
"numeric-comma-pre": function(a) {
var x = a == "-" ? 0 : a.replace(/,/, ".");
return parseFloat(x);
},

    "numeric-comma-asc": function(a, b) {
      return a < b ? -1 : a > b ? 1 : 0;
    },

    "numeric-comma-desc": function(a, b) {
      return a < b ? 1 : a > b ? -1 : 0;
    }
  }); 

`

Is there a function or property what I am missing, because I couldn't find anything in the documentation?

Let me know what you think!

44093009-cc8b827a-9fda-11e8-8cfc-df833f823c45
44093010-cf13322c-9fda-11e8-83b1-d5fcbe72113b

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the pagination and numeric sorting behavior using the jQuery.extend custom sort handlers shown in the issue. Compare behavior across pages and values such as 9 and 27; the issue is complete when the custom function continues across pagination and numeric ordering is correct.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, jquery
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.