Home News Contact Us Forum About Us Demos Products F.A.Q.
Shopping Cart
You currently have 0 items in your cart.


Recent Events
  • 05/09/2017 BIG Autumn SALE

    Use AUTUMN17 coupon code to buy our WordPress or Joomla! extensions with 25% discount. Hurry up! The offer is valid till 11 September.

  • 14/04/2017 Happy Easter

    Wish a Happy Easter and give 30% discount for all our WordPress and Joomla! extensions. Use EASTER17 coupon code. The offer is valid till 17 April.


2Checkout.com, Inc. is an authorized retailer of goods and services provided by ARI Soft. 2CheckOut




Follow us on twitter



Welcome, Guest
Please Login or Register.    Lost Password?

Number sorting problem
(1 viewing) (1) Guest
Go to bottomPage: 1
TOPIC: Number sorting problem
#58938
Number sorting problem 11 Months, 2 Weeks ago Karma: 0
I can't get columns with numbers to sort correctly in ARi data tables. 20 will be shown before 3 and after 2,8 when trying to sort the table. I'm using csv as source, table type is "ARI Table sorter" and I've tried setting "Digit" as sorting type for the column with numbers. I'm a bit uncertain what the meaning of "Column index" is, but tried using just the column number counting from left. Any advice to get those numbers sortable?

I've installed latest versjon of joomla and Ari data tables.

Url to table with problems: www.framtiden.no/gronne-tips/mat/klimagassutslipp-fra-matvarer.html

Best regards,
The administrator has disabled public write access.
 
#58942
Re:Number sorting problem 11 Months, 2 Weeks ago Karma: 666
Hello,

It is possible to sort this data type with help of "ARI Data Table" widget, but use . instead , in float numbers. Populate "Choose table type -> ARI Data Tables -> Columns settings -> Column index" parameter with zero-based column index (it means the first column will have 0 index, the second will have 1 index and etc.) and set "Columns settings -> Sorting type" parameter to "Numeric HTML" value.

Regards,
ARI Soft
The administrator has disabled public write access.
 
#58944
Re:Number sorting problem 11 Months, 2 Weeks ago Karma: 0
Is it possible to use comma instead for decimal numbers if some code or setting is changed? I can't use a period before decimals due to grammar rules in Norwegian.

Using "ARI Table sorter" there are no "Numeric HTML"-option for sorting type?

So rgd. the column index I just write add 0-1-2-3, for each column when there are four? Or add "0" for the columns with numbers?
Last Edit: 2016/11/02 12:19 By kehelle.
The administrator has disabled public write access.
 
#58945
Re:Number sorting problem 11 Months, 2 Weeks ago Karma: 666
It doesn't require to specify all columns in "Columns settings" parameters section. By default "text sorting type is used for all columns.

About using , instead . symbol, it requires to modify <joomla_directory>/modules/mod_aridatatables/includes/js/widgets/datatable/js/jquery.dataTables.extra.js file. Replace the following code:

Code:


jQuery.fn.dataTableExt.oSort['num-html-asc']  = function(a,b) {
var x = a.replace(/[^-.0-9]/g, "");
var y = b.replace(/[^-.0-9]/g, "");
x = parseFloat( x );
y = parseFloat( y );

if (isNaN(x))
x = Number.MAX_VALUE;
if (isNaN(y))
y = Number.MAX_VALUE;

return ((x < y) ? -1 : ((x > y) ?  1 : 0));
};

jQuery.fn.dataTableExt.oSort['num-html-desc'] = function(a,b) {
var x = a.replace(/[^-.0-9]/g, "");
var y = b.replace(/[^-.0-9]/g, "");
x = parseFloat( x );
y = parseFloat( y );

if (isNaN(x))
x = Number.MIN_VALUE;
if (isNaN(y))
y = Number.MIN_VALUE;

return ((x < y) ?  1 : ((x > y) ? -1 : 0));
};



with the following one:

Code:


jQuery.fn.dataTableExt.oSort['num-html-asc']  = function(a,b) {
var x = a.replace(/,/g,'.').replace(/[^-.0-9]/g, "");
var y = b.replace(/,/g,'.').replace(/[^-.0-9]/g, "");
x = parseFloat( x );
y = parseFloat( y );

if (isNaN(x))
x = Number.MAX_VALUE;
if (isNaN(y))
y = Number.MAX_VALUE;

return ((x < y) ? -1 : ((x > y) ?  1 : 0));
};

jQuery.fn.dataTableExt.oSort['num-html-desc'] = function(a,b) {
var x = a.replace(/,/g,'.').replace(/[^-.0-9]/g, "");
var y = b.replace(/,/g,'.').replace(/[^-.0-9]/g, "");
x = parseFloat( x );
y = parseFloat( y );

if (isNaN(x))
x = Number.MIN_VALUE;
if (isNaN(y))
y = Number.MIN_VALUE;

return ((x < y) ?  1 : ((x > y) ? -1 : 0));
};



and clean browser's cache.

Regards,
ARI Soft
The administrator has disabled public write access.
 
#58946
Re:Number sorting problem 11 Months, 2 Weeks ago Karma: 0
Thank you for excellent support. I will try this =)
The administrator has disabled public write access.
 
Go to topPage: 1