Inline Editing Stuck after submit

Inline Editing Stuck after submit

BerensBerens Posts: 2Questions: 1Answers: 0

Hi,
I'm very new to dataTables.
I implemented the inline edit. It is also sending the data to the Java Controller and saving it on the Database. But when I try to get to another cell I am stuck in the one I updated. I have to manually refresh the page that i can edit another Cell.

Is this caused by using a Template Engine to fill in the Data?

Thanks,
Jan

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,213Questions: 1Answers: 10,415 Site admin
    Answer ✓

    It sounds like the data being returned from the server isn't in the format that Editor requires. Is that correct?

    Allan

  • BerensBerens Posts: 2Questions: 1Answers: 0
    edited October 2016

    *EDIT: Issue fixed was a missunderstanding about formatting the returned data.

    The data with is POSTed to the server is in this format
    {"action":"edit","data":{"1":{"Name":"Test"}}} (or is row based POSTs better at the moment I only post each cell with is edited)

    The Return of the Server is the Template html after processed by the Velocity Engine

    I defined the ajax as following:

    ajax: {
             edit: {
                   type: 'POST',
                    url:  '../users', 
                    data: function (json) {
                         return JSON.stringify(json);
                      }
               }
    }
    

    The controller like:

            post("/users", (req, res) -> {
                
                System.out.println("put "+req.body());
            Map<String, Object> model = new HashMap<>();
                 model.put("title", "Users");
                 model.put("users", DBController.getUsers());
                 model.put("succ", "Success");
                 model.put("msg", "Success");
                 model.put("post", true);
                 return new ModelAndView(model, "/templates/users.html");
            }, new VelocityTemplateEngine());
    

    I am using for the REST Framework http://sparkjava.com/

This discussion has been closed.