1. #1
    Sencha User
    Join Date
    Feb 2012
    Posts
    7
    Vote Rating
    0
    mbalaji51 is on a distinguished road

      0  

    Default Grid not populated

    Grid not populated


    Hi
    i am using extjs 4 with stripes framework
    i am trying to populate a grid with the values from the database
    doing so i am getting the resonse of the pseristant class name
    but i am unable to populate the grid with the values


    the store of my grid is as follows

    var gridStore = Ext.create('Ext.data.JsonStore',{
    fields : [{name : 'receiptsId', type:'int'},
    {name : 'amount',type:'decimal'},
    {name : 'createdDate',type:'date'},
    {name : 'noOfPcs',type:'int'},
    {name : 'receiptsNo',type:'string'}],
    proxy : {url : 'receipts.action',
    type : 'ajax',
    reader : {
    type : 'json',
    root : 'receiptsRecords',
    totalProperty : 'totalRecords'
    }}
    });

    and the method for the action is

    public void getReceipts(){
    try{
    Hashtable<String, Object> receiptsList = this.receiptsService.getAllReceipts();
    JSONObject getReceipts = new JSONObject();
    getReceipts.accumulate("receiptsRecords", receiptsList.get(MasterConstants.RECEIPTS_LIST));
    getReceipts.accumulate("totalRecords", receiptsList.get(MasterConstants.TOTAL_COUNT));
    getContext().getResponse().setContentType("text/json; charset=UTF-8");
    PrintWriter out = getContext().getResponse().getWriter();
    out.print(getReceipts);
    } catch(Exception e){
    e.printStackTrace();
    }
    }

    can anyone help me with this or may be a sample code for poulating the grid may also be useful

    thank you

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    8,911
    Vote Rating
    443
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    Please show a sample of your return JSON to populate grid.

    Should be something like:
    Code:
    {
        success: true,
        data: [
            {id_user: 1, user_name: 'ADMIN', first_name: 'System', last_name: 'Admin'},
            {id_user: 2, user_name: 'GUEST', first_name: 'Guest', last_name: 'User'}
        ]
    }
    Regards,
    Scott.

  3. #3
    Sencha User
    Join Date
    Feb 2012
    Posts
    7
    Vote Rating
    0
    mbalaji51 is on a distinguished road

      0  

    Default


    Previously i was getting a response of only the name of the model class

    now i changed my action and it works good but i dont think this is the correct method

    My action class

    public void getReceipts(){
    try{
    Hashtable<String, Object> receiptsList = this.receiptsService.getAllReceipts();
    JSONObject getReceipts = new JSONObject();
    List<Receipt> recList = (List<Receipt>) receiptsList.get(MasterConstants.RECEIPTS_LIST);
    int totalCount = (Integer) receiptsList.get(MasterConstants.TOTAL_COUNT);
    JSONArray itemList = new JSONArray();
    for(Receipt rec: recList){
    JSONObject j = new JSONObject();
    j.accumulate("receiptsId", rec.getReceiptsId());
    j.accumulate("amount", rec.getAmount());
    j.accumulate("createdDate", rec.getCreatedDate());
    j.accumulate("noOfPcs",rec.getNoOfPcs());
    j.accumulate("receiptsNo", rec.getReceiptsNo());
    itemList.put(j);
    }
    getReceipts.put("receiptsRecords", itemList);
    getReceipts.accumulate("totalRecords", totalCount);
    getContext().getResponse().setContentType("text/json; charset=UTF-8");
    PrintWriter out = getContext().getResponse().getWriter();
    out.print(getReceipts);
    } catch(Exception e){
    e.printStackTrace();
    }

    and the response i got is

    {"receiptsRecords":[{"amount":15000,"receiptsNo":"RC0001","noOfPcs":23,"receiptsId":1}],"totalRecords":1}

    if there are any suggestions please mention

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi