Skip to content

Commit

Permalink
Merge pull request #146 from edly-io/manan/EDLY-7141
Browse files Browse the repository at this point in the history
Fixed sorting for actual price and price columns in subscriptions tab
  • Loading branch information
manan-memon authored Oct 24, 2024
2 parents c76562a + 09c400f commit 267d1ad
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions ecommerce/static/js/views/subscription_list_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,19 @@ define([
confirmationDialog) {
'use strict';

// Custom sorting plugin for currency values
$.extend($.fn.dataTableExt.oSort, {
"currency-pre": function(value) {
return parseFloat(value.replace(/[^\d.-]/g, '')) || 0;
},
"currency-asc": function(a, b) {
return a - b;
},
"currency-desc": function(a, b) {
return b - a;
}
});

return Backbone.View.extend({
className: 'subscription-list-view',

Expand Down Expand Up @@ -83,10 +96,12 @@ define([
{
title: gettext('Actual Price'),
data: 'subscription_actual_price',
type: 'currency'
},
{
title: gettext('Price'),
data: 'subscription_price',
type: 'currency'
},
{
title: gettext('Active Status'),
Expand Down

0 comments on commit 267d1ad

Please sign in to comment.