Whenever I apply a filter to a list view using the default filter options, my script web part stops responding. The code I'm using for the web part is:
<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js'></script>
<script type='text/javascript'>
$(document).ready(function() {
$("tr").click(function()
{
var clickedId = this.id;
if (clickedId != "")
{
var realId = clickedId.split(',');
SP.UI.ModalDialog.showModalDialog(
{
//url to open on click
url: 'EditForm.aspx?ID=' + realId[1],
dialogReturnValueCallback: function(dialogResult)
{
SP.UI.ModalDialog.RefreshPage(dialogResult)
}
});
}
return false;
});
});
</script>
What this code does is open an edit form dialog whenever an item is clicked, after which it refreshes the page. Can anyone explain to me why this piece of code stops responding after applying a filter through the list view interface?