cc109c4e7b14db8811a02d155864770826812582 tdreszer Fri Dec 9 09:04:52 2011 -0800 Fixed subtrack sort loosing user setting in drop downs and fixed IE9 subVisDD being unclickable. diff --git src/hg/js/utils.js src/hg/js/utils.js index 968eaaf..0a256df 100644 --- src/hg/js/utils.js +++ src/hg/js/utils.js @@ -1254,45 +1254,42 @@ } function tableSort(tbody,sortColumns) {// Sorts table based upon rules passed in by function reference // Expects tbody to not sort thead, but could take table // The sort routine available is javascript array.sort(), which cannot sort rows directly // Until we have jQuery >=v1.4, we cannot easily convert tbody.rows[] inot a javascript array // So we will make our own array, sort, then then walk through the table and reorder // FIXME: Until better methods are developed, only sortOrder based sorts are supported and fnCompare is obsolete // Create array of the primary sort column's text var cols = new Array(); var trs = tbody.rows; $(trs).each(function(ix) { - //cols.push(new sortRow(this,sortColumns,$(this).clone())); var th = this.cells[sortColumns.cellIxs[0]]; if(sortColumns.useAbbr[0]) - cols.push(new sortField(th.abbr,sortColumns.reverse[0],$(this).clone())); // When jQuery >= v1.4, use detach() insterad of clone() + cols.push(new sortField(th.abbr,sortColumns.reverse[0],this)); else - cols.push(new sortField($(th).text(),sortColumns.reverse[0],$(this).clone())); + cols.push(new sortField($(th).text(),sortColumns.reverse[0],this)); }); // Sort the array - //cols.sort(sortRowCmp); cols.sort(sortFieldCmp); - // Now reorder the table - for(var cIx=0;cIx<cols.length;cIx++) { - $(tbody.rows[cIx]).replaceWith(cols[cIx].row); + for(var cIx=cols.length-1;cIx>=0;cIx--) { + $( cols[cIx].row ).insertBefore( tbody.rows[0]); } gTbody=tbody; gSortColumns=sortColumns; setTimeout('tableSortFinish(gTbody,gSortColumns)',5); // Avoid javascript timeouts! } function tableSortFinish(tbody,sortColumns) {// Additional sort cleanup. // This is in a separate function to allow calling with setTimeout() which will prevent javascript timeouts (I hope) tableSetPositions(tbody); if ($(tbody).hasClass('altColors')) sortedTableAlternateColors(tbody,sortColumns); $(tbody).parents("table.tableWithDragAndDrop").each(function (ix) { tableDragAndDropRegister(this);