Skip to content

Instantly share code, notes, and snippets.

@NigelKibodeaux
Last active December 13, 2015 23:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NigelKibodeaux/4989054 to your computer and use it in GitHub Desktop.
Save NigelKibodeaux/4989054 to your computer and use it in GitHub Desktop.
Improves the RDI intranet
$('.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