Editor response redraw and cell edit field focus issue

Editor response redraw and cell edit field focus issue

dmotorsdmotors Posts: 6Questions: 2Answers: 0

I am using the latest datatables and editor versions.

I can successfully click on a cell to edit a field and see that it sent an ajax to the server so my controller can catch it and make the proper changes in the database. Then I send back a proper json response and no errors are showing.

On the frontend side, the edit input box for the field I just edited is still highlighted for edit mode and doesn't disappear. I can't even click outside to lose the focus of it.

When I try to click another field to edit, now the field I just edited disappeared to blank. However if I click on it I still see the data.

I'm stuck at the part where after I make the changes to the database it should be redrawing the field I edited on frontend and not let me edit the field until I click it again but this part is where it's not happening.

If I refresh the page all changes are reflected.

Once again there's no errors in my inspector just frontend not completing all the way and redrawing and disabling edit box.

Answers

  • dmotorsdmotors Posts: 6Questions: 2Answers: 0

    Original Data: J2-DP-012
    Changed Data: J2-DP-0122

    I attached the picture to show for the "sku" column, the box is still edit-mode even after I hit enter to submit.

    If I refresh the page, it will show J2-DP-0122.

    If I click on a different sku row and try to edit that, now J2-DP-0122 is hidden.

    If I click back on J2-DP-0122, it is visible in edit-mode again.

    Hope that sort of explains what's happening for me.

  • dmotorsdmotors Posts: 6Questions: 2Answers: 0

    Seems if I turn on serverSide: true then it redraws fine, if this should work with it on or off then I suppose I still have an issue then.

  • allanallan Posts: 63,815Questions: 1Answers: 10,517 Site admin

    On the frontend side, the edit input box for the field I just edited is still highlighted for edit mode and doesn't disappear. I can't even click outside to lose the focus of it.

    This suggests that the JSON response is not int he format Editor expects.

    If you give me a link to the page I'd be happy to take a look and check.

    Allan

  • dmotorsdmotors Posts: 6Questions: 2Answers: 0

    I think I fixed my JSON response:

    return \Response::json(array(
                        'data' => array(
                            'DT_RowId' => $rowId,
                            $colName => $updatedValue
                        )
                    ));
    

    I get no errors with this. However now I'm just stuck on how to redraw only the field/row in question rather redraw the whole page.

    Also, does it matter if I am user server-side processing or should it be able to redraw either way?

  • allanallan Posts: 63,815Questions: 1Answers: 10,517 Site admin

    If you are using server-side processing any draw will redraw the whole page. That's how server-side processing is designed to work.

    Can you show me the JSON that is being returned by the edit request, and also a sample of the JSON that is being used to load the table initially please? Better yet, if you can give me a link to the page I'd be able to debug it directly and let you know what is going wrong.

    Allan

This discussion has been closed.