javascript - Sorting a column by percentage in Datatables that also contains html -
I have one percent percent of percentages I use to sort most of my table and if you have the most correct columns If you check, the text-based percentages do the right way.
The problem is ... I want to remove it and want to change it with CSS bars on the left side of it (the second highest pillar) I do not have to sort these CSS bars with databases. Can get
Here is the code that I call each I used the code to sort on the right-most column to use percentages in percentage sections. Any ideas how can I ignore DataTables everyone, just what is the HTML tag in my code above and the percentage based on that? Thanks for any help, you can give it, and please tell me that you need more information. EDIT1: It uses code to sort text percent And these options are used for datatable on that page (I can change the stuff as needed). EDIT2: EDIT3: solved IT I Go to what's done .... Combine the number with HTML with to: < Blockquote> HTML numeric data type detection and sorting capabilities are built in Datatable 1.10+. As this plug-in has been marked as excluded, it can be useful when working with earlier versions of datatable. I found the checks and posts that you posted: Numbers with HTML, did you try it? According to the document, this will tag the HTML tag and will be sorted with numbers. & lt; Td> ...
& lt; Div id = "positive" & gt; I use it. & Lt; Div class = "anime" style = "width: 27%;" & Gt; & Lt; Div class = "text" & gt; 27.05% & lt; / Div & gt; & Lt; / Div & gt; & Lt; / Div & gt;
jQuery.extend (jQuery.fn.dataTableExt.oSort, {" Percent-pre ": function (a) {var x = (a ==" - ") 0: A. position (/% /," "); return parflot (x);}," percent-acc ": function (A, B) {Return ((A & Lt; b) -1: ((a & gt; b)? 1: 0));}, "percent-character": function (a, b) {return ( (A & lt; b) 1: ((a & gt; b)? -1: 0));}});
$ (document) .ready (function () {$ ('# gradient-style'). DataTable ({ "BPaginate": True, "isorting": [[7, "desc"] [50, 100, 200, "all"]], "iDisplayLength": 50, "sPaginationType": "full_numbers", ["50, 100, 200, -1] ":" Integer "," sdom ": '' l 'h' lf & gt; RT & lt;" f "ip; ',' ao column deafs '': [[ "Bibleable": incorrect, "one goal": [0, 6]}], "AO column": [empty, null, null, null, null, empty, null, empty, zero, {"sType": "percent "}, {" SType ":" percent "}}}}}}};
percent here is the code that I have changed in my edit1 code.
/ * This HTML * / Var x = String (A). Replace (/ & lt; [\ s \ S] *? & Gt; / g, ""); Return parceflot (x); / * Whatever is left over, Remove the% symbol and type from that * / var y = (x == "-")? 0: x (/% /, ""); Return Paras Flot (Y);
update 2014:
Disapproved Answer:
jQuery.extend (jQuery.fn.dataTableExt.oSort, {"num-html-pre": function (a) {var x = string (a) .replace (/ & lt; [\ S \ S] *? & Gt; / g, ""); Return paraseph float (x);}, "num-html-asc": 1: (1: 0))}}, "num-html -desc ": function (A, B) {A (A and B) Return (A and Lt; B) 1: ((A and B; B)? -1: 0));}});
Comments
Post a Comment