Update A row with client side ajax implemetation - Page 2

Update A row with client side ajax implemetation

2»

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    why was the entire datatable rerendered?

    Because you are using server-side processing. With server-side processing, whenever DataTables does a draw, it will always make a request to the server (or whatever override function is used) for the data with which to draw the page.

    Allan

  • yishayhyishayh Posts: 108Questions: 17Answers: 0

    Hi Allan,

    Sorry, but I don't understand what's the difference with this example.
    In that example, you have

    ajax: "../php/staff.php",
    

    Which is a server side processing, but you don't rerender the entire table, do you?

    Thanks,
    Yishay

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    It doesn't use server-side processing (the serverSide option is not used in that example).

    It is used here, and you'll be able to see after an edit, all of the rows in the tbody are redrawn.

    Allan

  • yishayhyishayh Posts: 108Questions: 17Answers: 0

    Hi allan,

    I missed the fact that you need the serverSide option.
    What's the difference between implementing the ajax in the client and using a server ajax with the serverSide=false, why do we need our table to be redrawn?
    Why can't we mark the serverSide as false?

    Thanks,
    Yishay

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    serverSide=false

    That is the default - you should be able to mark it as false (although it is redundant since that is the default). In the configuration shown above you have serverSide:true. I'm not sure if you need server-side processing or not. Normally you would only need it if you are working with tens of thousands of rows. Full details about it are in the manual.

    Allan

  • yishayhyishayh Posts: 108Questions: 17Answers: 0

    Hi Allan,

    Sorry, I wasn't clear.
    We marked the field as false, but than our ajax function was not called.

    Thanks,
    Yishay

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    The ajax option should be called (as a function) on first loading of the table, if it is provided. It would only then be called again with ajax.reload() (assuming client-side processing now).

    Allan

  • yishayhyishayh Posts: 108Questions: 17Answers: 0

    Hi Allan,

    you are correct of course, we had an exception because of our ajax implementation.
    Now we have a strange behavior that after receiving the answer from the server (containing the row that was updated) and using it as the data for the successCallback

    successCallback({data:result.aaData});
    

    The updated row disappears from the table, any idea as to what can cause this?

    Many many thanks,
    Yishay

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    This is in Editor's success callback now is it? The edited row would disappear if the JSON response doesn't include the information about that row. See the client / server communication for Editor.

    Allan

  • yishayhyishayh Posts: 108Questions: 17Answers: 0

    Hi Allan,

    we just need to pass data back from the server, and that's what we do.
    I debugged it a bit and row.any() returned true so row.remove(); was called in the editor commit.
    action = "edit"
    identifier = {"sizzle1470139851858":{"parentNode":[3415,134,false]}}
    store={"rowIds":["5"]}
    data=our data.
    Were we suppose the row in some way? are we suppose to return something in the data that should do it?
    Can you help me understanding what to check?

    Many thanks,
    Yishay

  • yishayhyishayh Posts: 108Questions: 17Answers: 0

    Ok! I think the problem is that we are missing the DT_RowId from the returning value.
    If we put the value of the edited line in the DT_RowId of the data we get a new phenomena.
    We are using interceptors to set the cells renderFunc like so:
    renderFunc.function = function (data, type, row, meta)
    In the regular way we get information in the data, but when using the above concept we get data=null, do we need to change the way we work or are we missing something in our data when calling the successCallback.

    Thanks,
    Yishay

  • yishayhyishayh Posts: 108Questions: 17Answers: 0

    Hi Allan,

    We found the solutions to our problems.

    Many thanks for help along the way,
    Yishay

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Answer ✓

    Can you show me the data that you are passing to the success callback please?

    Allan

  • yishayhyishayh Posts: 108Questions: 17Answers: 0

    Hi Allan,

    sure, did you see that I wrote we overcome the issues we had?

    Thanks,
    Yishay

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Answer ✓

    Sorry I missed that - I had the thread open in a tab and we must of overlapped.

    Great to hear you've got it up and running now!

    Regards,
    Allan

This discussion has been closed.