Skip to content

Instantly share code, notes, and snippets.

@kmiscia
Created August 28, 2012 15:24
Show Gist options
  • Save kmiscia/3499071 to your computer and use it in GitHub Desktop.
Save kmiscia/3499071 to your computer and use it in GitHub Desktop.
function addStatusToDatagridLinks(data) {
$(".pagination a, th a, #headline .tabs a").each(function(index, element) {
var href = $(element).attr("href");
var params = href.slice(href.indexOf('?') + 1).split('&');
for(var i=0; i<params.length; i++) if(params[i].indexOf("selection=")===0) {
params[i] = "selection="+data;
break;
}
if(i===params.length) params.push("selection="+data);
$(element).attr("href", href.replace(/\?.*/, "?"+params.join("&")));
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment