[OpenLayers-Users] HTTP protocol with featureserver
Alexandre Dube
adube at mapgears.com
Wed Dec 10 18:30:36 EST 2008
Eric Lemoine wrote:
> On Wed, Dec 10, 2008 at 9:02 PM, Alexandre Dube <adube at mapgears.com> wrote:
>
>> Eric Lemoine wrote:
>>
>>> On Wed, Dec 10, 2008 at 8:42 PM, Andreas Hocevar <ahocevar at opengeo.org>
>>> wrote:
>>>
>>> It seems to be that response.insertIds, and thus Strategy.Save, is
>>> Protocol.WFS-specific, isn't it?
>>>
>>> If I'm correct Alexandre should not rely on the save strategy at this
>>> point, and use protocol.commit directly instead.
>>>
>>> --
>>> Eric
>>>
>>>
>> Yes, but Strategy.Save looks like it could be implemented as a standard for
>> each protocols. response.insertIds could be populated regarding of the
>> protocol type, I think...
>>
>> Anyway, I'll try what you said and come back if I've more trouble.
>>
>
> It is to be noted that the save strategy register an "on commit"
> callback which expects to be given a response object. The HTTP
> protocol does not pass a response object to the "on commit" callback,
> response objects are passed to "on create", "on update" and "on
> delete" callbacks one can register using something like:
>
> commit(features, {
> "update": {
> callback: onUpdate
> },
> "create": {
> callback: onCreate
> },
> "delete": {
> callback: onDelete
> }
> });
>
> Protocol.HTTP and Protocol.WFS are two different beasts at this time,
> making Strategies' lives hard.
> --
> Eric
>
Andreas, Eric,
Thank you both for your help.
Eric, I noticed the HTTP protocol didn't pass a response object when I
used the Protocol.Save, but I did a small change to correct that :
callUserCallback: function(resp, options) {
var opt = options[resp.requestType];
if(opt && opt.callback) {
opt.callback.call(opt.scope, resp);
}
if(resp.last && options.callback) {
options.callback.call(options.scope, resp); //<----- added resp
}
},
That way, I could get the onCommit of the save strategy to have the
response object.
Anyway, I'll try what you proposed instead. Thanks again.
Best regards,
--
Alexandre Dubé
Mapgears
www.mapgears.com
More information about the Users
mailing list