1. #1
    Sencha User
    Join Date
    Nov 2008
    Posts
    37
    Vote Rating
    0
    harjits is on a distinguished road

      0  

    Default Passing store data to server side

    Passing store data to server side


    Hi there,

    I have a grid whose store definition is as follows

    Code:
    this.store = new Ext.data.JsonStore({
            autoload : false,
            idProperty : 'groupID',
            root : 'Name_report',
            totalProperty : 'count',
            successProperty : 'success',
            messageProperty : "msg",
            autoScroll:true,
            fields : [
                {
                    name : 'entityID'
                },{
                name : 'groupID'
            }, {
                name : 'groupName'
            }, {
                name : 'originalName'
            }, {
                name : 'standardName'
            }
            ],
            remoteSort : false,
            proxy : new Ext.data.HttpProxy({
                url : QUERY_URL +"?type=NAME",
                defaultHeaders : {
                    Accept : 'application/json'
                },
                method : 'post',
                disableCaching : false
            })
        });

    I want to send the json representation of the store data to the server for generating reports. Is there any way I can do that ?

  2. #2
    Sencha User
    Join Date
    Jan 2011
    Posts
    544
    Vote Rating
    52
    willigogs is a jewel in the rough willigogs is a jewel in the rough willigogs is a jewel in the rough

      0  

    Default


    I'm not sure I understand what you want to send to the server?

    Can you give an example of what you expect to send?

  3. #3
    Sencha User
    Join Date
    Nov 2008
    Posts
    37
    Vote Rating
    0
    harjits is on a distinguished road

      0  

    Default


    I need to pass the data contained in the store

  4. #4
    Sencha User
    Join Date
    Jan 2011
    Posts
    544
    Vote Rating
    52
    willigogs is a jewel in the rough willigogs is a jewel in the rough willigogs is a jewel in the rough

      0  

    Default


    You need to pass the entire dataset held in the store? I'm not sure why you would need to do that - since it must already be populated by a call to a DB anyway?

    Why are you wanting to send every record?

  5. #5
    Sencha User
    Join Date
    Nov 2008
    Posts
    37
    Vote Rating
    0
    harjits is on a distinguished road

      0  

    Default


    That's what I need to know, how can I pass the entire data set. I can't query the DB again because in sme cases the query takes time to fetch the results and hence I don't want to query the DB again to fetch the data. Hence I need to pass the data which is contained in the store as JSON or some other format to the server to generate PDF.

  6. #6
    Sencha User
    Join Date
    Jan 2011
    Posts
    544
    Vote Rating
    52
    willigogs is a jewel in the rough willigogs is a jewel in the rough willigogs is a jewel in the rough

      0  

    Default


    Yes, this is possible.
    Code:
    // GRAB THE DATA OBJECT
    var data = store.reader.jsonData;
    // CONVERT TO JSON STRING
    var str = Ext.util.JSON.encode(data.Name_report);
    Then simply pass the str variable during your call to create the report.

  7. #7
    Sencha User
    Join Date
    Nov 2008
    Posts
    37
    Vote Rating
    0
    harjits is on a distinguished road

      0  

    Default


    That worked thanks....

Thread Participants: 1

Tags for this Thread