Last active
December 13, 2015 23:08
-
-
Save NigelKibodeaux/4989054 to your computer and use it in GitHub Desktop.
Improves the RDI intranet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('.ajax__tab_panel tr a').click(function(e){e.preventDefault();sorter(e)}); | |
function sorter(e){ | |
collection = $('#ctl00_ctl00_BodyContentPlaceHolder_ProjectTrackPlaceHolder1_TabContainer1_tpMyItems_ilcMyItems_gvIssues').find('.RDISelectableGridItem'); | |
var $tbody = $(e.srcElement).closest('tbody'); | |
index = $tbody.find('a').index(e.srcElement); console.log(index); | |
collection = collection.sort(function(a,b){return $(a).find('td:eq('+index+')').text() > $(b).find('td:eq('+index+')').text();}); | |
$tbody.find('.RDISelectableGridItem').remove(); | |
collection.each(function(){$tbody.append(this.outerHTML)}); | |
} | |
$('#ctl00_ctl00_BodyContentPlaceHolder_ProjectTrackPlaceHolder1_TabContainer1_tpMyItems_ddlProjects')[0].onchange = function(e){filter(e);}; | |
function filter(e) { | |
collection = $('#ctl00_ctl00_BodyContentPlaceHolder_ProjectTrackPlaceHolder1_TabContainer1_tpMyItems_ilcMyItems_gvIssues').find('.RDISelectableGridItem'); | |
var code = $(e.srcElement).val().split(' ')[0]; | |
collection.each(function(){ | |
var $r = $(this); | |
var rowCode = $r.find('td:eq(1)').text().trim(); | |
rowCode = rowCode.split('.')[0] + '.' + rowCode.split('.')[1]; | |
if (rowCode == code || code == 'All') | |
$r.show(); | |
else | |
$r.hide(); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment