Skip to content

Commit b082f3f

Browse files
committed
Updated searchpane comparisions
1 parent 0e4d442 commit b082f3f

File tree

2 files changed

+24
-16
lines changed

2 files changed

+24
-16
lines changed

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,5 +141,5 @@ For each PR made, an entry should be added to this changelog. It should contain
141141
- 1251-column-sorting-issue-curated-urls-count-sorts-by-delta-urls-count
142142
- Description: Fixed incorrect sorting behavior in Collections table where sorting by Curated URLs column was not working as expected.
143143
- Changes:
144-
- Added `data-order` attribute to Delta URLs and Curated URLs table cells to enable proper numeric sorting
145-
- Ensured raw numeric values are used for sorting while maintaining formatted display with anchor tags
144+
- Added `data-order` attribute to URL count columns for proper numeric sorting
145+
- Updated SearchPane comparisons to use `@data-order` values instead of string-based loose equality checks to ensure correct numeric filtering

sde_indexing_helper/static/js/collection_list.js

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -138,43 +138,47 @@ let table = $("#collection_table").DataTable({
138138
{
139139
label: "0 URLs",
140140
value: function (rowData, rowIdx) {
141-
return $(rowData[COLUMNS.DELTA_URLS]).text() == 0;
141+
return parseInt(rowData[COLUMNS.DELTA_URLS]['@data-order']) === 0;
142142
},
143143
},
144144
{
145145
label: "1 solo URL",
146146
value: function (rowData, rowIdx) {
147-
return $(rowData[COLUMNS.DELTA_URLS]).text() == 1;
147+
return parseInt(rowData[COLUMNS.DELTA_URLS]['@data-order']) === 1;
148148
},
149149
},
150150
{
151151
label: "1 to 100 URLs",
152152
value: function (rowData, rowIdx) {
153-
return $(rowData[COLUMNS.DELTA_URLS]).text() <= 100 && $(rowData[COLUMNS.DELTA_URLS]).text() > 1;
153+
const value = parseInt(rowData[COLUMNS.DELTA_URLS]['@data-order']);
154+
return value > 1 && value <= 100;
154155
},
155156
},
156157
{
157158
label: "100 to 1,000 URLs",
158159
value: function (rowData, rowIdx) {
159-
return $(rowData[COLUMNS.DELTA_URLS]).text() <= 1000 && $(rowData[COLUMNS.DELTA_URLS]).text() > 100;
160+
const value = parseInt(rowData[COLUMNS.DELTA_URLS]['@data-order']);
161+
return value > 100 && value <= 1000;
160162
},
161163
},
162164
{
163165
label: "1,000 to 10,000 URLs",
164166
value: function (rowData, rowIdx) {
165-
return $(rowData[COLUMNS.DELTA_URLS]).text() <= 10000 && $(rowData[COLUMNS.DELTA_URLS]).text() > 1000;
167+
const value = parseInt(rowData[COLUMNS.DELTA_URLS]['@data-order']);
168+
return value > 1000 && value <= 10000;
166169
},
167170
},
168171
{
169172
label: "10,000 to 100,000 URLs",
170173
value: function (rowData, rowIdx) {
171-
return $(rowData[COLUMNS.DELTA_URLS]).text() <= 100000 && $(rowData[COLUMNS.DELTA_URLS]).text() > 10000;
174+
const value = parseInt(rowData[COLUMNS.DELTA_URLS]['@data-order']);
175+
return value > 10000 && value <= 100000;
172176
},
173177
},
174178
{
175179
label: "Over 100,000 URLs",
176180
value: function (rowData, rowIdx) {
177-
return $(rowData[COLUMNS.DELTA_URLS]).text() > 100000;
181+
return parseInt(rowData[COLUMNS.DELTA_URLS]['@data-order']) > 100000;
178182
},
179183
},
180184
],
@@ -189,43 +193,47 @@ let table = $("#collection_table").DataTable({
189193
{
190194
label: "0 URLs",
191195
value: function (rowData, rowIdx) {
192-
return $(rowData[COLUMNS.CURATED_URLS]).text() == 0;
196+
return parseInt(rowData[COLUMNS.CURATED_URLS]['@data-order']) === 0;
193197
},
194198
},
195199
{
196200
label: "1 solo URL",
197201
value: function (rowData, rowIdx) {
198-
return $(rowData[COLUMNS.CURATED_URLS]).text() == 1;
202+
return parseInt(rowData[COLUMNS.CURATED_URLS]['@data-order']) === 1;
199203
},
200204
},
201205
{
202206
label: "1 to 100 URLs",
203207
value: function (rowData, rowIdx) {
204-
return $(rowData[COLUMNS.CURATED_URLS]).text() <= 100 && $(rowData[COLUMNS.CURATED_URLS]).text() > 1;
208+
const value = parseInt(rowData[COLUMNS.CURATED_URLS]['@data-order']);
209+
return value > 1 && value <= 100;
205210
},
206211
},
207212
{
208213
label: "100 to 1,000 URLs",
209214
value: function (rowData, rowIdx) {
210-
return $(rowData[COLUMNS.CURATED_URLS]).text() <= 1000 && $(rowData[COLUMNS.CURATED_URLS]).text() > 100;
215+
const value = parseInt(rowData[COLUMNS.CURATED_URLS]['@data-order']);
216+
return value > 100 && value <= 1000;
211217
},
212218
},
213219
{
214220
label: "1,000 to 10,000 URLs",
215221
value: function (rowData, rowIdx) {
216-
return $(rowData[COLUMNS.CURATED_URLS]).text() <= 10000 && $(rowData[COLUMNS.CURATED_URLS]).text() > 1000;
222+
const value = parseInt(rowData[COLUMNS.CURATED_URLS]['@data-order']);
223+
return value > 1000 && value <= 10000;
217224
},
218225
},
219226
{
220227
label: "10,000 to 100,000 URLs",
221228
value: function (rowData, rowIdx) {
222-
return $(rowData[COLUMNS.CURATED_URLS]).text() <= 100000 && $(rowData[COLUMNS.CURATED_URLS]).text() > 10000;
229+
const value = parseInt(rowData[COLUMNS.CURATED_URLS]['@data-order']);
230+
return value > 10000 && value <= 100000;
223231
},
224232
},
225233
{
226234
label: "Over 100,000 URLs",
227235
value: function (rowData, rowIdx) {
228-
return $(rowData[COLUMNS.CURATED_URLS]).text() > 100000;
236+
return parseInt(rowData[COLUMNS.CURATED_URLS]['@data-order']) > 100000;
229237
},
230238
},
231239
],

0 commit comments

Comments
 (0)