1. #171
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    87
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    You could set store.start = 0 before filtering the store.

  2. #172
    Ext User
    Join Date
    Oct 2010
    Posts
    3
    Vote Rating
    0
    Woodlander is on a distinguished road

      0  

    Question


    Hi,

    I'm working on updating a rather big ASP.Net based ExtJs application from 2.2 to 3.3. The earlier version used PagingMemoryProxy which stoped working after updating. I'm now trying to replace it with PagingStore instead. In order to learn PagingStore I tried to write a simple page with a grid that loads a list of users. Strange thing is that the first time the grid populates it shows all >1000 users on one page (Display text says "Displaying users 1 - 1046 of 1046). First after refreshing the grid or clicking next page, the correct paging kicks in. What am I doing wrong?
    Code:
    Ext.onReady(function() {
            Ext.QuickTips.init();
    
            var record = Ext.data.Record.create([
                { name: 'Name' },
                { name: 'Id' }
            ]);
    
            var reader = new Ext.data.JsonReader({ root: 'rows' }, record);
    
            var ds = new Ext.ux.data.PagingStore({
                proxy: new Ext.data.HttpProxy({
                    url: 'WebServices/User.asmx/GetUsers',
                    method: 'POST',
                    headers: { 'Content-type': 'application/json' }
                }),
                autoLoad: Ext.encode({params:{start:0, limit:30}}),
                reader: reader,
                remoteSort: true
            });
    
    
            var cm = new Ext.grid.ColumnModel([
                { id: 'Name', header: "Name", width: 60, sortable: true, dataIndex: 'Name' },
                { id: 'Id', header: "Id", width: 200, sortable: true, dataIndex: 'Id' }
            ]);
            
            var toolbar = new Ext.PagingToolbar({
                pageSize: 30,
                store: ds,
                displayInfo: true,
                displayMsg: 'Displaying users {0} - {1} of {2}',
                emptyMsg: "No users to display"
    
            })
    
            var grid = new Ext.grid.GridPanel({
                id: 'myGrid',
                store: ds,
                width: 500,
                height: 500,
                cm: cm,
                viewConfig: {
                    forceFit: true
                },
                style: 'padding: 10px;',
                stripeRows: true,
                renderTo: 'divEmployees',
    
                //Paging
                bbar: toolbar
            });
            
    
        });

  3. #173
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    87
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    Why are you encoding the parameters? I recommend:
    Code:
    autoLoad: {params:{start:0, limit:30}},
    Also, I recommend using the Ext.ux.PagingToolbar that comes with PagingStore, instead of Ext.PagingToolbar (not required, but fixes some bugs).

  4. #174
    Ext User
    Join Date
    Oct 2010
    Posts
    3
    Vote Rating
    0
    Woodlander is on a distinguished road

      0  

    Default


    Quote Originally Posted by Condor View Post
    Why are you encoding the parameters? I recommend:
    Code:
    autoLoad: {params:{start:0, limit:30}},
    Also, I recommend using the Ext.ux.PagingToolbar that comes with PagingStore, instead of Ext.PagingToolbar (not required, but fixes some bugs).
    Thank you for your reply!

    Removing the Ext.Encode gives me an error: "Invalid JSON primitive" and I think it is because the POST sends the data like this : start=0&limit=30.

    Setting autoLoad: true loads the users but with the same problem with all users on one page. The toolbar still shows Page 1 of 35 - Displaying 1 of 1046 users. I replaced Ext.PagingToolbar with Ext.ux.PagingToolbar.

  5. #175
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    87
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    That's because you are setting the header to Content-type:headers:application/json.

    Do you actually want to send application/json and not application/x-www-form-urlencoded data?

    In that case you should not be doing this by setting the Content-type, but by changing the parameters in the beforeload, e.g.
    Code:
    listeners: {
      beforeload: function(store, options) {
        options.jsonData = Ext.apply({}, options.params, store.baseParams);
      }
    }

  6. #176
    Ext User
    Join Date
    Oct 2010
    Posts
    3
    Vote Rating
    0
    Woodlander is on a distinguished road

      0  

    Default


    Thanks! Changing the parameters in the beforeload did the trick.

  7. #177
    Ext JS Premium Member
    Join Date
    Dec 2007
    Location
    Berne / Switzerland
    Posts
    96
    Vote Rating
    0
    buergi is on a distinguished road

      0  

    Default


    Hi Condor!

    I use the PagingGroupingStore with over 2000 records and a limit of 50. After filtering I have 900 records left and I need to iterate through every record (or row). What's the best trick to do that?

  8. #178
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    87
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    You mean all filtered records on all pages? Use:
    Code:
    pagingStore.allData.each(function(record){...});

  9. #179
    Ext JS Premium Member
    Join Date
    Dec 2007
    Location
    Berne / Switzerland
    Posts
    96
    Vote Rating
    0
    buergi is on a distinguished road

      0  

    Default


    Yep, perfect! You're my localhost hero ;-)

    btw: Is there a way to select records on different pages? My selection is gone after a pagechange.

  10. #180
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    87
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    There is a plugin for CheckboxSelectionModel that makes it remember selections across pages (see User Extension forum).

Thread Participants: 106

  1. Animal (3 Posts)
  2. galdaka (2 Posts)
  3. cgi-bin (4 Posts)
  4. tchitani (4 Posts)
  5. tobiu (1 Post)
  6. steffenk (1 Post)
  7. renaudham (1 Post)
  8. markpele (1 Post)
  9. Sesshomurai (1 Post)
  10. teddyjas (5 Posts)
  11. buergi (2 Posts)
  12. Buzzwords (2 Posts)
  13. tomcheng76 (4 Posts)
  14. kveeiv (1 Post)
  15. dhisnotnull (2 Posts)
  16. walldorff (1 Post)
  17. brizardh (2 Posts)
  18. elizard (1 Post)
  19. Remy (1 Post)
  20. renoye (8 Posts)
  21. despay (1 Post)
  22. lwexler (2 Posts)
  23. tomim (1 Post)
  24. Mjollnir26 (1 Post)
  25. allenlako (3 Posts)
  26. Andrea Gioia (1 Post)
  27. wp.joju (1 Post)
  28. genio (2 Posts)
  29. 828 (1 Post)
  30. ljschrenk (4 Posts)
  31. diablo (3 Posts)
  32. blakel (1 Post)
  33. Grolubao (2 Posts)
  34. makiavelli (2 Posts)
  35. elesel (1 Post)
  36. Capt.JackSparrow (2 Posts)
  37. ferryman (3 Posts)
  38. cwford (1 Post)
  39. 3dm (1 Post)
  40. imnilesh (1 Post)
  41. Rotterdam (2 Posts)
  42. nandubochkar (1 Post)
  43. Dustin Graham (1 Post)
  44. Boing (2 Posts)
  45. tdteti_ (8 Posts)
  46. vtulin (2 Posts)
  47. hello (1 Post)
  48. PranKe01 (2 Posts)
  49. jbusuulwa (6 Posts)
  50. cwilson (1 Post)
  51. ronaldploeger (1 Post)
  52. scblue (1 Post)
  53. saadkhan (2 Posts)
  54. subbugv (6 Posts)
  55. p3p3 (1 Post)
  56. computeraholic (1 Post)
  57. calabacita (3 Posts)
  58. aghextjs (1 Post)
  59. Arindam Das (1 Post)
  60. aw_zahid (1 Post)
  61. deister (1 Post)
  62. billprince (1 Post)
  63. amol.gaikwad (2 Posts)
  64. george4rotech (7 Posts)
  65. leonrenkema (1 Post)
  66. mvassau (1 Post)
  67. aDoF96 (2 Posts)
  68. attack11 (3 Posts)
  69. chakrics (1 Post)
  70. thangamalar (3 Posts)
  71. mayurid (1 Post)
  72. Lobo (1 Post)
  73. christian130 (3 Posts)
  74. elbino (3 Posts)
  75. eashwaranp (1 Post)
  76. atul.sachan@capgemini.com (3 Posts)
  77. Joe Kuan (1 Post)
  78. kent78 (4 Posts)
  79. dsk1962 (1 Post)
  80. Woodlander (3 Posts)
  81. msmolyak (1 Post)
  82. mond (4 Posts)
  83. anandhasubha (1 Post)
  84. David Warren (1 Post)
  85. colinm (2 Posts)
  86. sothea (1 Post)
  87. incanus (1 Post)
  88. MarceloCajr (1 Post)
  89. knackwurst (1 Post)
  90. Pattie (1 Post)
  91. parnold3 (1 Post)
  92. StanimirPanchev (1 Post)
  93. palashkumar1010 (1 Post)
  94. ash4aque (3 Posts)
  95. farfar (3 Posts)
  96. PrashanthShetty (1 Post)
  97. brprashanth (2 Posts)
  98. perseusy (3 Posts)
  99. theWalli (1 Post)
  100. hieu79vn (1 Post)
  101. Hisamitsu (1 Post)
  102. hensor (1 Post)
  103. northmh (3 Posts)
  104. parax (1 Post)
  105. PankajG (1 Post)
  106. reedcat (1 Post)
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..."