1. #1
    Sencha User
    Join Date
    Feb 2013
    Location
    NZ
    Posts
    66
    Answers
    5
    Vote Rating
    0
    mazhar.shaikh is on a distinguished road

      0  

    Default Answered: Read the reader.rawData value from a PUT request's response.

    Answered: Read the reader.rawData value from a PUT request's response.


    I am sending multiple lines from my grid as a PUT request to the server.

    The web service than deals with these lines and creates Header and Lines in the db. The service creates a Unique Header ID for each set of lines that send. The response of this PUT request is the HeaderID that it just created.

    I can see that ID on the
    Code:
    store.proxy.reader.rawData
    but I cant access it. See below:
    Capture.JPG

    Using
    Code:
    store.proxy.reader.rawData
    gives me [Object#object]]. Can somebody guide me how to access those two highlighted properties of the reader.

    Please note its a PUT request's response that I am showing in the pic.

    Thanks

  2. You can't do that. The sync is an asynchronous operation, by the time you're accessing it, the server hasn't got the data back yet. Listen to the write event on the store.

  3. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,120
    Answers
    346
    Vote Rating
    508
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    When are you trying to access it? The console will keep updating to have the latest value, so it may not be ready by the time you're trying to get it.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  4. #3
    Sencha User
    Join Date
    Feb 2013
    Location
    NZ
    Posts
    66
    Answers
    5
    Vote Rating
    0
    mazhar.shaikh is on a distinguished road

      0  

    Default Right after Store.sync().

    Right after Store.sync().


    I am trying to access it after store.sync().

    Code:
    var grid = Ext.getCmp('reviewPicklistGrid');
    var selection = grid.getSelectionModel().getSelection();
    var store = Ext.getStore('GeneratePicklist');
    if (selection.length > 0){    
        store.loadRecords(selection);
        for(var i=0; i < selection.length; i++){
            //selection[i].data.isSelected = true;
            var record = store.getAt(i);        
            record.dirty = true;
            //console.log(record);
            if (selection.length == 1){
                store.proxy.url = PickList.globals.url + 'Orders/PrintPicklistSingle/';    
            }
            else{
                store.proxy.url = PickList.globals.url + 'Orders/PrintPicklist/';        
            }        
        }
    
    
        store.sync();
    }
    // This is where I am using it
    console.log(store.proxy.reader.rawData);
    var getId = store.proxy.reader.rawData;

  5. #4
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,120
    Answers
    346
    Vote Rating
    508
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      1  

    Default


    You can't do that. The sync is an asynchronous operation, by the time you're accessing it, the server hasn't got the data back yet. Listen to the write event on the store.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  6. #5
    Sencha User
    Join Date
    Feb 2013
    Location
    NZ
    Posts
    66
    Answers
    5
    Vote Rating
    0
    mazhar.shaikh is on a distinguished road

      0  

    Default Got hold of the Id.

    Got hold of the Id.


    Thanks. That does the trick. I can see the ID on the write listener of the store.

    But the problem is how do I use that id in my controller code as above. This listener that I just created is on the store.

    Could you guide me how do I do that.

  7. #6
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,120
    Answers
    346
    Vote Rating
    508
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    Not really sure what you mean, the way you add a listener is the same.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  8. #7
    Sencha User
    Join Date
    Feb 2013
    Location
    NZ
    Posts
    66
    Answers
    5
    Vote Rating
    0
    mazhar.shaikh is on a distinguished road

      0  

    Default


    I mean

    I want to add the listener to the controller instead of the store itself. Can you guide me how to do that.

    I am looking at something like this. I got this from stackoverflow:

    Code:
    init : function () 
    {   
    this.getUsersStoreStore().addListener('write',this.finishedLoading, this);    
    this.control({    
        // widgets event handlers   
       });
    },
    But what goes in place of this.finishedLoading and what goes in this.control(). Never done this before. Sorry.

  9. #8
    Sencha User
    Join Date
    Feb 2013
    Location
    NZ
    Posts
    66
    Answers
    5
    Vote Rating
    0
    mazhar.shaikh is on a distinguished road

      0  

    Default Got it running.

    Got it running.


    Thanks mate.. The listening to Write event was what I needed. Cheers

Thread Participants: 1

Tags for this Thread

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar