This is a migrated thread and some comments may be shown as answers.

How to properly update a row after the update button is clicked (and a json response comes back with the data to be updated)?

2 Answers 54 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Andrew
Top achievements
Rank 1
Andrew asked on 20 Mar 2013, 10:14 PM
When I edit a bunch of fields in a row, I click update and it sends the data to my php server. The php server sends back some json data and I want the same row to update.

For example:

I update a row and it has some fields in it like projectscore, adjustment and weight. The server saves the data and sends back the project total so it can be properly updated in the table. right now this is the json postback
{"id":"1","ptotal":75}

id is the id of the row (specified in the table, this is working), and ptotal is the column name of the column I need updated

How do I update the column in the table from the response from the server after an update or a create?

This is a server side php, client side kendo system (the table is a nested table in a hierarchy setup)

2 Answers, 1 is accepted

Sort by
0
Andrew
Top achievements
Rank 1
answered on 21 Mar 2013, 04:47 PM
I see that the inline response in the demo is 
"jQuery18209422706338401393_1363880656837([{"ProductID":78,"ProductName":"aaa","UnitPrice":4,"UnitsInStock":2,"Discontinued":false}])"

My response right now is:
[{"projectId":81,"projectname":"test12","projectscore":"81","adjustment":"0","weight":"80","completiondate":"2013-03-21","ptotal":5}]

what is "jQuery18209422706338401393_1363880656837()" do I need it and where does it come from? the table keeps duplicating data and the return ID never gets assigned to the new record generated (or the rest of the variables dont update either) 
0
Andrew
Top achievements
Rank 1
answered on 21 Mar 2013, 09:04 PM
Took me awhile but I had to change my response to this:
{"d":[{"projectId":"1","projectname":"test project1","projectscore":"71","adjustment":"1","weight":"100","completiondate":"2013-03-21","ptotal":72,"tscore":"61"}]}

and my data bound to "d" and it worked
Tags
Grid
Asked by
Andrew
Top achievements
Rank 1
Answers by
Andrew
Top achievements
Rank 1
Share this question
or