PDA

View Full Version : Problem with api/destroy on a store



bbxx
30 Oct 2009, 11:32 AM
I have an issue when I am deleting a row from a grid. I can delete the row, it will disappear from the grid, and then I save. When I save, the store uses the api destroy parameter, and calls my server script. This is what I return:



[{
"success":true,
"message":"Destroyed row"
}]Problem is that then the grid pops the row back in place as if the call failed!! BUT wait, there's more. Everything works flawlessly when deleting multiple rows at the same time. I don't understand because the same result as listed above is returned from the server.

Does ExtJS expect a different response in the case of a single vs. multiple row delete?

bbxx
30 Oct 2009, 11:57 AM
I also tried this to no avail: (results is my root, and ID is my idProperty)



[{

"success":true,
"message":"Destroyed row",
"results":
{
"ID":"19"
}

}]

MaximGB
30 Oct 2009, 12:11 PM
Why do you wrap the response with an array, it should be just an object. That might be the failure reason.

bbxx
30 Oct 2009, 12:21 PM
Why do you wrap the response with an array, it should be just an object. That might be the failure reason.

Good catch; this worked:



{"success":true,"message":"Destroyed successfully"}

Thanks!