0

I have a Sharepoint 2013 list (html table) where I would like to get the row index if I click on a row element. After failing several times by using MouseEvent object I find a quite simple solution here.

So I am using a code like this:

$(document).ready(function()
{
$("tr").click(function (){
        alert($("tr").index(this));
    });
});

This is working well, but if I click on the button to go to the next 30 element of the table it stops working and even if I return to the first page not working anymore. So I have to reload the page to make it works again. What I noticed is that the page is the same, so it is not redirect to a new url, but it gets an addition to the url if I click on the button like: "#InplviewHashea3cdf07-1a28-4a44-bcb2-01f7d45a76c0=Paged%3DTRUE-p_ID%3D340-PageFirstRow%3D31". Sadly I am new to JS so I have no idea how to deal with this. Thanks you very much for any suggestion!

2
  • So you have data in a list and you create an HTML table out of the list? Is this through custom code, ie JavaScript? Commented Nov 8, 2017 at 18:51
  • Yeah Sharepoint custom lists are HTML tables. So if u create a custom list in SP u get a HTML table u can freely edit (from the GUI or u can add code too) and add new columns. It have a default limit to show only 30 row and it have a "next" button at the bottom of the page to go to the next 30 element if u press it. I added javascript code to get the rowindex, but it is stops working if I go to the next 30 element. Commented Nov 9, 2017 at 9:18

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.