Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Sencha touch pull refresh no update

  1. #1
    Sencha User
    Join Date
    Nov 2012
    Posts
    84
    Vote Rating
    0
      0  

    Default Sencha touch pull refresh no update

    Hi I need to pull refresh a list when a record updated.Please c my code below

    List.js
    Code:
     Ext.define('bluebutton.view.BlueButton.TransactionList', {        extend: 'Ext.List',
            xtype: 'transactionlistcard',
            id :'transactionlistcard',
            requires: [
                'Ext.field.Select',
                'Ext.field.Search',
              
                'Ext.plugin.ListPaging',
                'Ext.plugin.PullRefresh',
        
                'bluebutton.store.BlueButton.TransactionList',
                'bluebutton.view.BlueButton.TransactionListDetail',
        
            ],
            config: {
                  styleHtmlContent: true,
                scrollable: 'vertical',
                itemHeight :20,
                variableHeights : false,
                store : { xclass : 'bluebutton.store.BlueButton.TransactionList'},
               grouped: true,
                indexBar: true,
                  id :'transactionlist',
                    masked: {
                        xtype: 'loadmask',
                        message: 'loading...'
                    }, // masked
               plugins: [
                              
                                    { xclass: 'Ext.plugin.PullRefresh'
        
                            
                                    },
        
                                  { 
                                       xclass: 'Ext.plugin.ListPaging',
        //                                 autoPaging: true,
                                      
                                         
                                
                                },
                        ],
        
                
                
                emptyText: '<p class="no-search-results">No Transaction record found matching that search</p>',
                itemTpl: Ext.create(
                   'Ext.XTemplate',
                    '<div class="tweet-wrapper">',
                        '<table>',
                            '<tr>',
                                '<td rowspan="2" width="28%" >',
        //                        '<div style="padding-left: 30px;">',
        //                        '   <img src="{imgUrl}" width="140" height="130" /></div>',
                                '</td>',
                                '<td>',
                                '   <div class="tweet">',
                                
                                '       <h3>Transaction ID: {transactionId} , Point: {updatedPoint} pts , Action: {action}</h3>',
                                '       <h3>Status: {status}, Transaction By: {fullName} , Transaction Date: {createDateTime}</h3>',
                               
                                '   </div>',
                                '</td>',
                            '</tr>',
                        '</table>',
                    '</div>'
        
        
        
                ),
        
               
        
            },
            
        
    
        });


    store.js
    Code:
    Ext.define('bluebutton.store.BlueButton.TransactionList', {        extend: 'Ext.data.Store',
               requires: [
                      'bluebutton.model.BlueButton.TransactionList'
            ],
        
            config: {
                grouper: {
                    groupFn: function (record) {
                        return record.get('createDateTime');
                    }
                },
        
                  
        
                    model: 'bluebutton.model.BlueButton.TransactionList',
                    pageSize: 5,
                    autoLoad: true,
                    storeId: 'transactionlist',
                    sorters: 'createDateTime',
                    groupDir: 'DESC',
        
                    clearOnPageLoad: true,  // This is true by default
                    
        
        
            }
        });

    Model.js
    Code:
      Ext.define('bluebutton.model.BlueButton.TransactionList', {        extend: 'Ext.data.Model',
            config: {
                idProperty: 'transactionId',
                fields: [
        
                    {  name :'transactionId'},
                    {  name: 'merchant_bbID'  },
                    {  name: 'sessionId'  },
                    {  name: 'deviceId'  },
                  
                    {  name: 'createDateTime' },
                    {  name: 'fullName' },
                    {  name: 'action' },
                    {  name: 'updatedPoint' },
                    {  name: 'createDate' },
                     {  name: 'status' },
                     {  name: 'refresh' },
                    
        
        
                    
        
        
                ],
        
                proxy: {
                    type: 'rest',
                   
        //           url: 'http://192.168.251.131:8080/WebCommon/rest/BBWebService/getPointTransactionList',
                    url: 'http://mixsoloffice.no-ip.biz:82/WebCommon/rest/BBWebService/getPointTransactionList',
                    actionMethods: {
                        create: 'POST',
                        read: 'GET',
                        update: 'PUT',
                        destroy: 'DELETE'
                    },
                            
                            
                              noCache: false, // get rid of the '_dc' url parameter
                            
                            extraParams: {
                                sessionId: "1",
                                deviceId: "1",
                                merchant_bbID: "merchant1",
        
                            // add as many as you need
                        },
        
        
        
                    reader: {
                        type: 'json',
                        rootProperty: 'pointTransHistoryList',
                         totalProperty: 'totalRecord',
                        successProperty: 'success'
                        
                    },
        
                    writer: {
                        type: 'json',
                      
                    },
                }
        
        
        
            }
        
        });

    Json return format
    Code:
     {"success":true,"pointTransHistoryList":    
        [{"transactionId":"162","createDate":"08\/03\/2013","createDateTime":"2013-03-08 13:01:01.101","fullName":"Ivor Kee Aik Hau","action":"add","updatedPoint":"44.00","status":"Success"},
        
        {"transactionId":"161","createDate":"07\/03\/2013","createDateTime":"2013-03-07 20:00:04.456","fullName":"Ivor Kee Aik Hau","action":"deduct","updatedPoint":"5.00","status":"Success"},
        
        {"transactionId":"160","createDate":"07\/03\/2013","createDateTime":"2013-03-07 20:00:03.345","fullName":"Ivor Kee Aik Hau","action":"deduct","updatedPoint":"4.00","status":"Success"},
        
        {"transactionId":"159","createDate":"07\/03\/2013","createDateTime":"2013-03-07 20:00:02.234","fullName":"Ivor Kee Aik Hau","action":"deduct","updatedPoint":"3.00","status":"Success"},
        
        {"transactionId":"158","createDate":"07\/03\/2013","createDateTime":"2013-03-07 20:00:01.123","fullName":"Ivor Kee Aik Hau","action":"deduct","updatedPoint":"2.00","status":"Success"}],"totalRecord":11}
    But the pull refresh seem not able to update. Please give some solution

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,551
    Answers
    3931
    Vote Rating
    1271
      0  

    Default

    What do you mean not able to update?
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  3. #3
    Sencha User
    Join Date
    Nov 2012
    Posts
    84
    Vote Rating
    0
      0  

    Default

    Quote Originally Posted by mitchellsimoens View Post
    What do you mean not able to update?
    The pull refresh seem dint refresh the list. I cant get any latest result once i update record in my database. even the server return me correct result

  4. #4
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,551
    Answers
    3931
    Vote Rating
    1271
      0  

    Default

    Did you check the dev tools to inspect the response?
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  5. #5
    Sencha User
    Join Date
    Nov 2012
    Posts
    84
    Vote Rating
    0
      0  

    Default

    Quote Originally Posted by mitchellsimoens View Post
    Did you check the dev tools to inspect the response?
    Yup. I check dy. the response is return me json result correctly

  6. #6

    Join Date
    Feb 2013
    Posts
    7
    Vote Rating
    2
      0  

    Default

    I have the same problem. The store gets updated but the list is only refreshed if a new record is added or one deleted. If a field changes on an existing record the template does not show the new value of the field.

  7. #7
    Sencha User
    Join Date
    Nov 2012
    Posts
    84
    Vote Rating
    0
      0  

    Default

    Quote Originally Posted by robowen View Post
    I have the same problem. The store gets updated but the list is only refreshed if a new record is added or one deleted. If a field changes on an existing record the template does not show the new value of the field.
    So did you got solution. I face this problem few month ago already. I still haven get the solution . Please update me once u fix the problem. Ty

  8. #8
    Sencha Premium Member
    Join Date
    Dec 2012
    Posts
    50
    Answers
    3
    Vote Rating
    0
      0  

    Default

    Get this to use the good old refreshFn: https://github.com/p5hema2/Sencha-PullRefresh-RefreshFn

    Or extend the plugin to define it by yourself.

  9. #9
    Sencha User
    Join Date
    Nov 2012
    Posts
    84
    Vote Rating
    0
      0  

    Default

    Quote Originally Posted by Isnogud View Post
    Get this to use the good old refreshFn: https://github.com/p5hema2/Sencha-PullRefresh-RefreshFn

    Or extend the plugin to define it by yourself.
    oK. thanks so much. Btw actually I face this problem since ST 2.1. By using refreshFn, the paging of the list will lose. Did you gt any example about this

  10. #10
    Sencha Premium Member
    Join Date
    Dec 2012
    Posts
    50
    Answers
    3
    Vote Rating
    0
      0  

    Default

    You are using ST 2.2.0, right?

    What do you mean the paging will lose? You can reset the currentPage everytime you refresh the View or you don't.

    It would be like this:

    Code:
    refreshFn : function() {
    store.currentPage = 1;
    store.load();
    }

Page 1 of 2 12 LastLast

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
  •