Go to page using tr id

Go to page using tr id

jgm196jgm196 Posts: 3Questions: 2Answers: 0

How can I get my table go to page using the tr id?

For example, I have a table with 500 rows. And if I click in a button I want my table to go to the which contains the row with the id=300.

I´va tried to get it using fnGetNodes, fnGetPosition and fnDisplayRow with no success, can anyone help me?

Answers

  • HayezbHayezb Posts: 10Questions: 1Answers: 0

    Assuming you are using Server Side, add this at the end of your table load.

    $this->datatables->add_column('edit', '<a href="yourpath.com/$1">view</a>', 'ID');

  • jgm196jgm196 Posts: 3Questions: 2Answers: 0

    No, I´m not using server side. I have a modal which display a list of clients and some inputs for insert additional data. For example, if you want to insert a new register in the mainpage, you click on "add new register". Then a modal opens, and you select one client from the datatable and fill all other input fields. When you save the data, in the mainpage I insert a new register based in the information added from the modal(in this register I store the id of the row on the datatable clients).

    This part works well, my problem is if I want to edit this register, I need to fill the information on the modal with the information of the register. I fill correctly the inputs, and I would like using the row id, go to the page of the client in the register.

    For example, if I store in the register that the rowid="usr_201", when I click on the edit button, I display the modal with the datatable and I would like to set the page, to the page which contains this id.

This discussion has been closed.