Unanswered: model.save() and the required server response
I have a model with a rest proxy (json reader/writer) defined. The json reader has the 'totalProperty' set to 'pagination.total_entries' as per my internal setup using rails 3 and 'will_paginate' gem.
Everything works fine when I query the records to show them in a grid but when I try to save a new model instance I get the 'failure' callback hit instead of success even though I respond with the 'success: true' message along with the newly created object.
Digging the failure operation param I get the following message: 'error: "Cannot read property 'total_entries' of undefined"' which means that the save operation looks for the pagination object (totalProperty) in the response. If I add a dummy pagination.total_entries = 1 in the response the success callback is hit but it seems pretty weird for extjs to seek for 'totalProperty' when I'm saving a record.
Is this expected behavior and I'm supposed to respond with this dummy in all my create actions?
Why is extjs expecting a collection-type response when I'm working with a single record (POST/PUT)?
It works but it's a dumb approach to force the server to send such data just for extjs to play nice. Why should the reader look for a collection (total) when I'm posting a record. I'm using 4.1* by the way.
Originally Posted by flanders
Tags for this Thread