From 282ea74a764d247f70c1c73c1400bcc322aade08 Mon Sep 17 00:00:00 2001 From: Ed Chipman Date: Sat, 29 Aug 2015 14:54:46 -0300 Subject: [PATCH] Fixed issue where the even/odd highlight would differ from what the server would generate after sorting --- javascript/GridFieldSortableRows.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/javascript/GridFieldSortableRows.js b/javascript/GridFieldSortableRows.js index 27c23a8..adfe365 100644 --- a/javascript/GridFieldSortableRows.js +++ b/javascript/GridFieldSortableRows.js @@ -30,15 +30,16 @@ pageSort=false; return; } - - $('.ss-gridfield-item').removeClass('first last odd even'); - $('.ss-gridfield-item').first().addClass('first'); - $('.ss-gridfield-item:odd').last().addClass('last'); - $('.ss-gridfield-item:even').addClass('even'); - $('.ss-gridfield-item:odd').addClass('odd'); + + var gridItems=gridField.getItems(); + + gridItems.removeClass('first last odd even'); + gridItems.first().addClass('first'); + gridItems.last().addClass('last'); + gridItems.filter(':even').addClass('odd'); + gridItems.filter(':odd').addClass('even'); var dataRows=[]; - var gridItems=gridField.getItems(); var button=refCheckbox.parent().find('.sortablerows-savesort');