Page 2 of 4 FirstFirst 1234 LastLast
Results 11 to 20 of 32

Thread: select all elements of grid and send them in json string

  1. #11

    Default

    hey i used the same code n it worked bt now it is giving the same problem
    var data = [];
    grid_mapping.getStore().each(function(rec){
    data.push(rec.data);
    });
    Ext.Ajax.request({
    url: 'mappingScreen.action?act=testajax',
    method : 'get',
    jsonData: data,
    success: function(response){
    alert('success');
    }
    });
    i cant see the response in firebug...

  2. #12

    Default

    hey now i am not getting response in firebug...what should i do

  3. #13
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,245

    Default

    So you do see the request being sent, but you don't see a response (the icon keeps spinning)?

    In that case you have to check your server.

  4. #14

    Default

    i get success from server and i even can see the post tab in firebug having JSON and source as expected but cant see anything in the response tab in firebug...
    the data i get in source is in the form
    [{"id":3354,"UserElements":"a","StdTaxElem":"aa"},{"id":3353,"UserElements":"Travelling Expenses","StdTaxElem":...}.......and so on
    but i cant see anything in response tab...
    I want that response in my java class by request.getParameter("list")...
    plz help

  5. #15
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,245

    Default

    This is application/json content and not x-form-encoded.

    If you wanted that then you should use:
    Code:
    Ext.Ajax.request({
      url: '...',
      params: {
        list: Ext.encode(data)
      },
      ...
    });

  6. #16

    Default

    hey actually i dont want the data to be in the url coz it is v.large...
    I tried ur post n it worked bt nw m facing da same prob dat response wont come in the response tab...

  7. #17
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,245

    Default

    1. params are only added to the URL for method:'GET'. With the default method:'POST' they are in the postdata.

    2. Debug your server. Is your sever actually sending a response?

  8. #18

    Default

    i am using the following code

    handler : function() {
    store_UEST.proxy.setApi('create','mappingScreen.action?act=saveMapping');
    store_UEST.save();
    var data = [];
    grid_mapping.getStore().each(function(rec){
    data.push(rec.data);
    });
    Ext.Ajax.request({
    url: 'mappingScreen.action?act=testajax',
    jsonData: data,
    success: function(response){
    alert('success from ajax');
    }
    });
    }
    and success from ajax alert msg is also been displayed...
    but the response tab in firebug is showing nothing...

  9. #19
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,245

    Default

    So your server isn't returning anything besides HTTP status 200. If that's the way you programmed your server, then it's fine.

  10. #20

    Default

    This is my js code for grid panel...i want to take all the values of the grid and send them as a response to the server...
    var grid_mapping = new Ext.grid.GridPanel({
    id : 'grid_mapping',
    store : store_UEST,
    width : 450,
    height : 700,
    columns : [{
    header : "User Elements",
    width : 150,
    sortable : true,
    dataIndex : 'UserElements',
    mode : 'local',
    editor : {
    xtype : 'textfield',
    allowBlank : true
    }
    }, {
    header : "Standard Taxonomy Elements",
    width : 150,
    mode : 'local',
    sortable : true,
    dataIndex : 'StdTaxElem',
    editor : {
    xtype : 'textfield',
    allowBlank : false
    }
    }

    ],
    viewConfig : {
    forcefit : true
    },
    plugins : [editor],

    height : 700,
    width : 450,
    frame : true,
    tbar : [
    {
    // cls: 'x-btn-text-icon',
    icon : 'images/save-icon.png',
    text : 'Save All Modifications',
    handler : function() {
    var data = [];
    grid_mapping.getStore().each(function(rec){
    data.push(rec.data);
    });
    Ext.Ajax.request({
    url: 'mappingScreen.action?act=testajax',
    jsonData: data,
    success: function(response){
    alert('success from ajax');
    }
    });

    }
    }]
    });

    On my java class my code ll be of the form:
    public void testajax(){
    request = ServletActionContext.getRequest();
    System.out.println("json from ajax list: "+request.getParameter("list"));
    }

    what should i do...plz help
    i e1 got the expected o/p bt donno y m nt getting it nw...wher m i goin wrong?

Page 2 of 4 FirstFirst 1234 LastLast

Similar Threads

  1. Best way to send String value in PageConfig object of a grid with remote paging
    By avilanchee in forum Ext GWT: Help & Discussion (1.x)
    Replies: 1
    Last Post: 4 Mar 2010, 11:10 PM
  2. convert the data of the grid to JSON string
    By wguo in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 3 Jul 2009, 3:09 AM
  3. Load Remote Web Service JSON string in a GRID
    By alexbariv in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 11 Jun 2009, 3:21 AM
  4. grid.getStore().getModifiedRecords() -> JSON string -> Save to server
    By Setti in forum Ext 2.x: Help & Discussion
    Replies: 4
    Last Post: 17 Jul 2008, 7:19 AM

Posting Permissions

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