dedoz
14 Mar 2012, 1:58 AM
im using 4.1 beta 3 with a model using direct proxy and everything works fine, i can save to the database and get right success responses from server, but the record will go phatom : false even when success is false.
p = Ext.create('Person',{name:'robinson'});
console.log(p.phantom); // true
p.save({
callback : function(record,operation)
{ if (!operation.response.success)
console.log('ERROR : ' + operation.response.message);
else
console.log('sucess');
console.log(p.phantom); // false
console.log(record.phantom); //false
}
});
my json response is
{ "type":"rpc",
"tid":1,
"action":"testQuery",
"method":"Insert",
"result":
{"id":null,"name":"robinson"},
"success":false,
"message":"unique,name"
}
detects the success : false in the if(!operation.response.sucess) and prints the correct menssage to the console log.
thats working fine.
problem is , even when sucess is false, record changed to phantom:false (means it was saved to the server) i know i can set it manually to true again but i think shouldnt be happening and i dont know the consecuences of setting panthom back to true manually. also prolly is happening in store.sync() (havent tested) and there is goin to be harder to detect the record that needs to be set to phantom true again.
so im doing something wrong or its another phantom problem (note another :d)
question #2
if i put console.log(operation.wasSuccessful()) inside the callback, prints true ?¿?¿
but console.log(operation.response.sucess) prints false which is the correct answer. maybe thats the source of the panthom problem ? operation.sucess is true and only operation.response.sucess is false. maybe im mising something ?
EDIT
its worst than that, the whole record assumes the new values even when sucess is false, so
doing a reject wont give me the old values back D:
// if i add this to the callback
console.log(record); // values that shouldnt be assumed
record.reject();
console.log(record); // same values, cannot reject to get the old values
anyone ? D:
dang i need to finish an app like 3 month ago D: my boss wants to kill me and i keep finding bugs this is like the #11 in data package i posted like 3 cuz consumes too much time to isolate the test cases and redact the bug and then i wont get any fix soon so after i found one bug i just override with a fix and keep goin D: but its sad ill be looking for a new job soon i guess D:
p = Ext.create('Person',{name:'robinson'});
console.log(p.phantom); // true
p.save({
callback : function(record,operation)
{ if (!operation.response.success)
console.log('ERROR : ' + operation.response.message);
else
console.log('sucess');
console.log(p.phantom); // false
console.log(record.phantom); //false
}
});
my json response is
{ "type":"rpc",
"tid":1,
"action":"testQuery",
"method":"Insert",
"result":
{"id":null,"name":"robinson"},
"success":false,
"message":"unique,name"
}
detects the success : false in the if(!operation.response.sucess) and prints the correct menssage to the console log.
thats working fine.
problem is , even when sucess is false, record changed to phantom:false (means it was saved to the server) i know i can set it manually to true again but i think shouldnt be happening and i dont know the consecuences of setting panthom back to true manually. also prolly is happening in store.sync() (havent tested) and there is goin to be harder to detect the record that needs to be set to phantom true again.
so im doing something wrong or its another phantom problem (note another :d)
question #2
if i put console.log(operation.wasSuccessful()) inside the callback, prints true ?¿?¿
but console.log(operation.response.sucess) prints false which is the correct answer. maybe thats the source of the panthom problem ? operation.sucess is true and only operation.response.sucess is false. maybe im mising something ?
EDIT
its worst than that, the whole record assumes the new values even when sucess is false, so
doing a reject wont give me the old values back D:
// if i add this to the callback
console.log(record); // values that shouldnt be assumed
record.reject();
console.log(record); // same values, cannot reject to get the old values
anyone ? D:
dang i need to finish an app like 3 month ago D: my boss wants to kill me and i keep finding bugs this is like the #11 in data package i posted like 3 cuz consumes too much time to isolate the test cases and redact the bug and then i wont get any fix soon so after i found one bug i just override with a fix and keep goin D: but its sad ill be looking for a new job soon i guess D: