Results 1 to 2 of 2

Thread: 4.1 beta 3 - ignores response success state

    Success! Looks like we've fixed this one. According to our records the fix was applied for EXTJS-5622 in
  1. #1
    Sencha User
    Join Date
    Dec 2011
    Vote Rating

    Default 4.1 beta 3 - ignores response success state

    I posted this in Q&A forum and mitchell told me it could be a bug
    (sorry for my english)
    Ext version tested:
    ExtJs 4.1 beta 1 and beta 3
    cannot be tested in beta 2 because was broken in that version and was fixed back in beta 3.

    Browser versions tested against:
    Firefox 10.0.2
    Chrome 17.0.963.66

    Its related to a http response with success:false.
    when success is false will save the new values anyway and phanthom will go false.

    this is important to me because i use success:false message:'unique,fieldname' to avoid saving records that breaks unique constrains and they are very common, and this only can be checked on server side.

    Steps to reproduce the problem:
    create any model with a direc proxy (i guess other proxys have the same problem i think is not related to the proxy)
    create an instance of the model
    save the model
    the response must include success:false

    The result that was expected:
    the record wont be set with the bad values after success:false
    also the record has to be phantom still, because save failed.

    also returning sucess:false i expected operation.wasSuccessful() = false
    when operation.response.success is false.

    The result that occurs instead:
    when success : false
    the record is set with the bad values.
    record.phatom = false.
    operation.wasSuccessful() = true even when operation.response.success is false
    record.reject() wont give me back the old values.

    Test Case:
    im using model with direct proxy and everything works fine, i can save to the database and get right success responses from server (prints the response message when success:false or prints "success" when sucess:true), everything is working fine but the problems describes above and below.
        p = Ext.create('Person',{name:'robinson'});
        console.log(p.phantom); // true{
            callback : function(record,operation)
            {    if (!operation.response.success)
                {   console.log('ERROR : ' + operation.response.message);
                    console.log(p.getData()); // has the name 'robinson' which is OK
                    p.reject(); // to reject the changed because success:false
                    console.log(p.getData()); // has the name 'robinson' which is not OK i cant get the old values back
                                            // just as example as we had an already loaded record.
                    operation.wasSuccessful() // prints true, should be false
                    console.log(p.phantom); // false, should be true 
    my json response is
    {    "type":"rpc",
    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.
    also theres the problem that is set the values to the record no matter success state.
    and reject() wont give me the old values back, seems like after the save the record gots a commit() with the invalid values.

  2. #2
    Sencha User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Gainesville, FL
    Vote Rating


    And bug opened.
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts