Results 1 to 7 of 7

Thread: [CLOSED][3.0.0] Ext.data.Store exception is type response

    Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Ext JS Premium Member
    Join Date
    Aug 2007
    Location
    Germany
    Posts
    139

    Default [CLOSED][3.0.0] Ext.data.Store exception is type response

    If i get an successfull response on a read action of my grid, in following answers
    the reponse type of exception is "response" (instead of remote). May be you want to take a look at it.

    In my Testacase i tried the same answer
    PHP Code:
    echo '{"success":false,"message":"Destroy failed","data":[]}'
    once as first action, and it worked with exception and type remote

    and once after a read action was done before successfull. Now the success false still triggers an exception but type is NOT remote anymore. Its "response" now.

    If i m wrong or this behavior is wanted, delete this post

    Thanks!
    Spirit

    Version : EXT 3.0

  2. #2
    Ext JS Premium Member
    Join Date
    Aug 2007
    Location
    Germany
    Posts
    139

    Default Hmmm

    I m not gettin rid off it.
    In another application I get the same result.

    I investigated that i get an exception
    TypeError: m is undefined message=m is undefined

    and i dunno why.

  3. #3
    Ext JS Premium Member
    Join Date
    Aug 2007
    Location
    Germany
    Posts
    139

    Default Testcase to try

    Ok, i set up a simple Testcase which shows my problem:

    Html File:
    PHP Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <
    html>
      <
    head>
        <
    title></title>
              <
    meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

            <
    link rel="stylesheet" type="text/css" href="ext3/resources/css/ext-all.css" />
            <
    script type="text/javascript" src="ext3/adapter/ext/ext-base.js"></script>
            <script type="text/javascript" src="ext3/ext-all.js"></script>
            <script>
                
            var proxySP = new Ext.data.HttpProxy({
                api: {
                    read : 'fail.php'
                }
            });

            var readerSP = new Ext.data.JsonReader({
                totalProperty: 'total',
                successProperty: 'success',
                idProperty: 'id',
                root: 'data'
            }, [
            {
                name: 'id'
            }
            ]);


            var storeSP = new Ext.data.JsonStore({
                id:'wizQ',
                reader: readerSP,
                proxy: proxySP,
                autoSave: false,
                listeners: {
                    load : function(store, records, options) {
                        // only load with filled array!
                        console.log('done');
                    },
                    exception : function(proxy, type, action, options, res, arg) {
                        console.log(type,action,options, res, arg);
                        if (type === 'remote') {
                            Ext.Msg.show({
                                title: 'REMOTE EXCEPTION',
                                msg: res.message,
                                icon: Ext.MessageBox.ERROR,
                                buttons: Ext.Msg.OK
                            });
                        }
                    }
                }
            });

            storeSP.load();
            </script>

      </head>
      <body>
        TODO write content
      </body>
    </html> 

    and the PHP Script fail.php which returns Json in response:
    PHP Code:
    <?php
    echo '{"success":"true","message":"Destroy failed","data":[{"id":"5"}], "total":"1"}';
    exit;
    ?>
    JSON returned:
    PHP Code:
    {"success":"true","message":"Destroy failed","data":[{"id":"5"}], "total":"1"
    That throws the exception event and not as expected the load event in storeSP.
    Console log from the Testcase is:

    PHP Code:
    response read Object request=Object reader=Object scope=Object Object tId=0 status=200 statusText=OK TypeErrorm is undefined message=m is undefined 

    Hopefully someone can help me now

  4. #4
    Sencha Premium User
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,258

    Default

    Not a bug:

    Code:
    var storeSP = new Ext.data.JsonStore({
        id: 'wizQ',
        totalProperty: 'total',
        successProperty: 'success',
        idProperty: 'id',
        root: 'data',
        fields: ['id'],
        url: 'data.php',
        autoSave: false,
        listeners: {
            load: function(store, records, options){
                // only load with filled array!
                console.log('done');
            },
            exception: function(proxy, type, action, options, res, arg){
                console.trace();
                if(type === 'remote'){
                    Ext.Msg.show({
                        title: 'REMOTE EXCEPTION',
                        msg: res.message,
                        icon: Ext.MessageBox.ERROR,
                        buttons: Ext.Msg.OK
                    });
                }
            }
        }
    });
    
    storeSP.load();
    Marking as closed.

  5. #5

    Default

    I am also getting the same problem.
    Whats the solution...??? or what am I doing wrong?

  6. #6
    Sencha User
    Join Date
    Jan 2008
    Posts
    119

    Default

    This is also a problem for me. I'm echoing {"success":"false"} from PHP and the exception is still response type and I can read the response myself in Firebug so...what can I do ?

  7. #7

    Default

    why you say it is not a bug? according to DataProxy API document, when the response is valid, the type should be 'remote' not 'response'. and the response argument should be a Ext.Response object, not xmlHttpRequest.


    • type : StringThe value of this parameter will be either 'response' or 'remote'.

      • 'response' : An invalid response from the server was returned: either 404, 500 or the response meta-data does not match that defined in the DataReader (e.g.: root, idProperty, successProperty).
      • 'remote' : A valid response was returned from the server having successProperty === false. This response might contain an error-message sent from the server. For example, the user may have failed authentication/authorization or a database validation error occurred.





    Quote Originally Posted by evant View Post
    Not a bug:

    Code:
    var storeSP = new Ext.data.JsonStore({
        id: 'wizQ',
        totalProperty: 'total',
        successProperty: 'success',
        idProperty: 'id',
        root: 'data',
        fields: ['id'],
        url: 'data.php',
        autoSave: false,
        listeners: {
            load: function(store, records, options){
                // only load with filled array!
                console.log('done');
            },
            exception: function(proxy, type, action, options, res, arg){
                console.trace();
                if(type === 'remote'){
                    Ext.Msg.show({
                        title: 'REMOTE EXCEPTION',
                        msg: res.message,
                        icon: Ext.MessageBox.ERROR,
                        buttons: Ext.Msg.OK
                    });
                }
            }
        }
    });
    
    storeSP.load();
    Marking as closed.

Posting Permissions

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