Editor not redrawing automatically when using ajax call.

Editor not redrawing automatically when using ajax call.

kartikeyas00kartikeyas00 Posts: 16Questions: 4Answers: 0

Link to test case:
http://live.datatables.net/hehowado/1/

Description of problem:

I have three problems/query which could be coming from related thing.

1) When I edit from the regular Edit button it doesn't redraw the table right away and I have to do a reload on success. This is not working great for me as if I am on 5th page and edit some data then when the page reloads on ajax success it throws me back to the same page. I would like something where I don't have to reload the page, just like here . What I am doing wrong here?

2) I am using autoFill extension, which is great but again when I use it with the editor with ajax call. It doesn't update the values on the table and I have to reload to see the reflected changes. Like the changes happens in the database but not in the frontend unless i reload/refresh. This has the same problem as above, that it would always throw me back on the front page.

3) I am using keyTables and editor together. When I edit a value it edits in the database as well as get reflected right away. But when I press enter to edit it the selector goes away after processing. Like the selector doesn't stay where it was (For example if it is editing Row1 Col5, after pressing enter to submit changes the selector should stay there but it doesn't). Is it possible to do?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 52,636Questions: 1Answers: 8,053 Site admin

    When I edit from the regular Edit button it doesn't redraw the table right away and I have to do a reload on success.

    Can you show me the response from the server when you send the Ajax request to update the row please?

    The other two questions really revolve around getting that resolved first I think.

    Thanks,
    Allan

  • kartikeyas00kartikeyas00 Posts: 16Questions: 4Answers: 0

    @allan
    This is the response I get when I edit with the edit button as well as autofill:

    {
      "data": null, 
      "error": null, 
      "message": "Successfully edited the row with ids ['841', '842'].", 
      "success": true
    }
    
    

    For instance, above I have edited two rows with the IDs ['841', '842']

    This is the response I get when I edit with the inline edit:

    {
      "data": "[{\"id\":841,\"year\":\"2016\",\"pid\":\"6917A\",\"piece_description\":\"\",\"piece_qty\":2,\"file_name\":\"PID-6917A-V1-60BCH-OSB1\",\"company\":\"Bennignton\",\"series\":\"SX Series\",\"seat_description\":\"BOW Rider\",\"seat_longdescription\":\"W\\/ Left Lounge\",\"side\":\"STARBARD\",\"piece_number\":1,\"total_pieces\":\"14\",\"colorid_1\":\"A\",\"extension_1\":\"01\",\"colorid_2\":\"\",\"extension_2\":\"02\",\"colorid_3\":\"\",\"extension_3\":\"03\",\"colorid_4\":\"\",\"extension_4\":\"04\",\"colorid_5\":\"\",\"extension_5\":\"05\",\"piece_or_pair\":\"Pc\",\"session_id\":\"000012\",\"initials\":\"KS\",\"user\":\"cmccn\",\"timestamp\":null}]", 
      "error": null, 
      "message": "Successfully edited the row with id 841.", 
      "success": true
    }
    

    I have edited the row with id 841 up there!

  • kartikeyas00kartikeyas00 Posts: 16Questions: 4Answers: 0

    I understand that I need to send the edited data back. So now the first two problems are solved but the number 3 is still a problem. The selector just go away and you have to use a mouse again to click back on table cell. You can see this behavior in my test case link as well!

  • colincolin Posts: 9,806Questions: 0Answers: 1,623

    It seems to be working in this example here. Could you take a look, please, and see if that helps, or if not, give steps on how to reproduce the issue,

    Colin

  • kartikeyas00kartikeyas00 Posts: 16Questions: 4Answers: 0

    @colin I already have a test case. Could you please take a look at that? To reproduce you just try to edit a cell with inline editing and you would find that selector just go away. It doesn't work as it should!

  • allanallan Posts: 52,636Questions: 1Answers: 8,053 Site admin

    The data part is wrong in both replies. In the first it is null, while in the second it is a string. It should be an array of row value objects. The second one almost looks correct, but it shouldn't be a string - just a plain JSON array.

    What code are you using on the server-side to process and return this data? Are you using the libraries we provide, or you own homebrew code? If you are using your own code, the documentation for what editor sends and what it expects in return is available here.

    Allan

  • kartikeyas00kartikeyas00 Posts: 16Questions: 4Answers: 0

    @allan I have corrected the first two issues but the third is still bugging me!

  • allanallan Posts: 52,636Questions: 1Answers: 8,053 Site admin
    Answer ✓

    If you use the nightly version of KeyTable that issue is resolved. Updated example: http://live.datatables.net/hehowado/3/edit .

    Allan

  • kartikeyas00kartikeyas00 Posts: 16Questions: 4Answers: 0

    Awesome! Do you know when it would be released?

  • colincolin Posts: 9,806Questions: 0Answers: 1,623

    Hopefully within the next week. We're aiming for this Friday, but it may slip, so it won't be long,

    Colin

Sign In or Register to comment.