Results 1 to 10 of 10

Thread: How to display waitMsg, success, failure on DataStore Loading?

  1. #1

    Question How to display waitMsg, success, failure on DataStore Loading?

    Anybody please help Y_Y . . .

    I'm doing delete PARTNER function. Before delete, I have to check that PARTNER is related with other item or not. If it related I have to alert warning message but if not that PARTNER will go to delete process.

    My problem is I didn't get any alert message although it success or fail.

    In my PHP code return like this ..

    if (success) {
    echo "{success:true}";
    } else {
    echo "{success: false, errors: { reason: 'Update Failed!!' }}";
    }


    This is my EXTJS code.

    PartnerDataStore.load({
    url: './php/partner.php',
    params: {
    task: "DELETE_PARTNER",
    partner_id: rec.get("partner_id")
    },
    waitMsg: 'Processing ...',
    success: function(objServerResponse){
    if(objServerResponse.responseText == 'success'){
    Ext.MessageBox.alert('Success','Item deleted.');
    }
    },
    failure : function(objServerResponse){
    Ext.MessageBox.alert('Failed', 'Error : ' + objServerResponse.responseText);
    }
    });


    What am I doing wrong?


    Please help ...

  2. #2

    Default

    Dispaly example avaliable in EXTJS Action PDF book go through find related more examles

  3. #3
    Sencha User laurentParis's Avatar
    Join Date
    Aug 2010
    Location
    paris
    Posts
    246

    Default

    try this
    PHP Code:
    PartnerDataStore.load({
        
    url'./php/partner.php',
        
    params: {
            
    task"DELETE_PARTNER",
            
    partner_idrec.get("partner_id")
        },
        
    waitMsg'Processing ...',
        
    success: function(objServerResponse){
            var 
    resp Ext.decode(objServerResponse.responseText);
            if(
    resp.success){
                
    Ext.MessageBox.alert('Success','Item deleted.');
            }
            else {
                
    Ext.MessageBox.alert('Error','xxx');
            }
        },
        
    failure : function(objServerResponse){                         // << intercept only error http
            
    Ext.MessageBox.alert('Failed''Error : ' objServerResponse.responseText);
        }
    }); 

  4. #4
    Sencha User laurentParis's Avatar
    Join Date
    Aug 2010
    Location
    paris
    Posts
    246

    Default

    try this :
    PHP Code:
    PartnerDataStore.load({
        
    url'./php/partner.php',
        
    params: {
            
    task"DELETE_PARTNER",
            
    partner_idrec.get("partner_id")
        },
        
    waitMsg'Processing ...',
        
    success: function(objServerResponse){
            var 
    resp Ext.decode(objServerResponse.responseText);
            if(
    resp.success){
                
    Ext.MessageBox.alert('Success','Item deleted.');
            }
            else {
                
    Ext.MessageBox.alert('Error','xxx');
            }
        },
        
    failure : function(objServerResponse){                         // << intercept only error http
            
    Ext.MessageBox.alert('Failed''Error : ' objServerResponse.responseText);
        }
    }); 

  5. #5
    Sencha User laurentParis's Avatar
    Join Date
    Aug 2010
    Location
    paris
    Posts
    246

    Default

    Try this
    Code:
    PartnerDataStore.load({
        url: './php/partner.php',
        params: {
            task: "DELETE_PARTNER",
            partner_id: rec.get("partner_id")
        },
        waitMsg: 'Processing ...',
        success: function(objServerResponse){
            var resp = Ext.decode(objServerResponse.responseText);
            if(resp.success){
                Ext.MessageBox.alert('Success','Item deleted.');
            }
            else {
                Ext.MessageBox.alert('Error','xxx');
            }
        },
        failure : function(objServerResponse){                         // << intercept only error http
            Ext.MessageBox.alert('Failed', 'Error : ' + objServerResponse.responseText);
        }
    });

  6. #6
    Sencha User laurentParis's Avatar
    Join Date
    Aug 2010
    Location
    paris
    Posts
    246

    Default

    failure intercept only http error

    use Ext.decode for convert string objServerResponse.responseText into json format
    and test it
    [/code]
    var resp = Ext.decode(objServerResponse.responseText);
    if(resp.success){
    Ext.MessageBox.alert('Success','Item deleted.');
    }
    else {
    Ext.MessageBox.alert('Error','xxx');
    }
    [/code]

  7. #7

    Default

    Please give me an example ... ? ? ? ?

  8. #8
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246

    Default

    1. Why are you loading a store? Why not use an Ext.Ajax.request?
    2. Your response isn't 'success'; it's {success:true} (so I recommend Ext.decode'ing the responseText).

  9. #9
    Sencha User
    Join Date
    Aug 2009
    Posts
    480

    Default

    Well... assuming your PartnerDataStore inherits from an Ext.data.*Store, you need to read the API Documentation about the load() method... You will quickly understand what's wrong. You should use Ext.Ajax.request for this, the load() method of the Ext.data.Store is for retriving records... and it doesn't support success, failure or waitMsg config options.

  10. #10

    Default

    Many thanks about all answers that all you guy gave me

    Now I got it. I should use Ext.Ajax.request instead .

    Great !!!! ^o^

Similar Threads

  1. Weird success / failure behaviour
    By bkraut in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 9 Sep 2009, 12:57 PM
  2. FormPanel success and failure
    By wilbrandt in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 30 Jun 2009, 6:44 AM
  3. How to remove waitMsg on error (not failure)
    By NOSLOW in forum Ext 2.x: Help & Discussion
    Replies: 10
    Last Post: 7 Jan 2009, 1:29 PM
  4. submit a form: neither failure nor success
    By iBeb in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 21 Nov 2008, 3:05 AM
  5. How to display success / failure message on form submission
    By aamir in forum Ext 2.x: Help & Discussion
    Replies: 4
    Last Post: 24 Jan 2008, 11:39 PM

Tags for this Thread

Posting Permissions

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