Editor - How to jump to the created row?

Editor - How to jump to the created row?

almircamposalmircampos Posts: 13Questions: 5Answers: 0

Dears,

I'm struggling with another(*) simple question: how do I jump to the created row after submitting the form (from the Editor) and receiving the callback from the server?

The problem is that I'm receiving all the correct code from the server, as you can see below:

{"id":95,"description":"Test #1000","preferred":false,"DT_RowId":"95"}

However, the table.rows().data() shows that the row doesn't have id, and other data:

Object { description="Test #1000", preferred=[0], id=""} (Firebug)

This problem happens even I use the table.ajax.reload() to refresh the data. (I've tested that in several events: create, postSubmit, close, etc. with the same result). The interesting thing is that the HTML is correct and the data is shown correctly in the table:

<tr id="95" class="odd" role="row">
<td>95</td>
<td class="sorting_2">Test #1000</td>
<td class="preferredStyleClass sorting_1">
</tr>

But if I try to use the table.row(<param>) to find the row, it results undefined.

I also was trying to figure out how to do it using the examples on the Manual (https://editor.datatables.net/examples/bubble-editing/inTableControls.html), but I wasn't able to solve the problem.

Your help is greatly appreciated.

Thank you.

Almir Campos.

(*) the other simple question is here: https://datatables.net/forums/discussion/28689/editor-how-to-add-a-help-icon-for-each-field-in-a-form#latest

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,361Questions: 1Answers: 10,448 Site admin

    Hi Almir,

    To jump the paging to a page based on data, you will need to use a plug-in:

    This in combination with the postCreate event should do it.

    Regards,
    Allan

  • almircamposalmircampos Posts: 13Questions: 5Answers: 0

    Hi, Allan.

    I'm afraid that problem wasn't solved.

    1 - I didn't use the row().show() because it requires using the .add() function, and I'm using the ajax: create: { url:, type:, data: } on the Editor.

    2 - I decided to use the jumpToData() function because the postCreate event gives me the data from the server. Then, I can use the "id" I received from the server (e.g, "114") as the key for searching in the column 0. But it didn't work.

    3 - Then, I put a console.log( idReceivedFromServer, table.column(0, {order: 'current'}).data() ); inside the postCreate , and the result was:

    114, Object[92, 96, 99, 3, 8, 7, 14, 12, 1, 13, 93, "", 91, 100, 85, 86, 87, 84, 88, 4, 76, 77, 78, 79, 80, 81, 82, 83, 89, 90, 2, 5, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 95]
    

    Please note that the "" between 93 and 91 should be the id received from server. But it is an empty string ( because of that, the jumpToData() method doesn't find the id and jump to the data).

    4 - However, the new row is shown correctly when I manually move to its page. Even if I use the table.ajax.reloat() before the jumpToData() method ,and use the console.log to show the data in the column 0, the resulting array still is '... 93, "", 91...'.

    5 - To me, it means that I'm probably missing something between the DataTablesEditor postCreate event and the DataTables drawing.

    Any clues?

    Thank you.

    Regards,

    Allan.

  • allanallan Posts: 63,361Questions: 1Answers: 10,448 Site admin

    Hi,

    Are you able to give me a link to the page so I can debug it please? It sounds like the server might not be responding to the Editor Ajax request with the expected data, but I would need to be able to see it to be sure.

    Allan

  • almircamposalmircampos Posts: 13Questions: 5Answers: 0

    Hi, Allan.

    The application is under construction in my computer and cannot be public, due some restrictions from the client. However, I can deploy it into a test server on the internet and send you the link. Do you have a private email address I can send the link to?

    Thank you.

    Almir.

  • allanallan Posts: 63,361Questions: 1Answers: 10,448 Site admin
    Answer ✓

    If you click my name above and then hit the "Send message" button, that will send a PM direct to myself.

    Regards,
    Allan

  • almircamposalmircampos Posts: 13Questions: 5Answers: 0

    Hi, Allan.

    Sorry for the delay in responding. I'm working on this system as volunteer and sometimes I can't work on it during the weekdays.

    I just posted a private message for you.

    Thank you very much!

    Almir Campos.

This discussion has been closed.