Hybrid View

  1. #1
    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  

    Cool Ext.ux.data.PagingStore [v0.5]

    Ext.ux.data.PagingStore [v0.5]


    Ext 3 natively only supports remote paging (the server needs to process the start and limit parameters).

    For local paging you can use the PagingMemoryProxy user extension, but it has some disadvantages:
    1. You have to write extra code to remote load the data for the proxy.
    2. query, filter and collect only work on the current page. You have to write extra code to use the PagingMemoryProxy filter support.
    3. Local sorting works, but you need to set remoteSort:true. There is no remote sorting support.
    4. Added and removed records are only remembered for the current page.
    5. Changing the page is relatively slow (PagingMemoryProxy reprocesses all data).

    All these problems can be solved by adding paging support to Store instead of MemoryProxy.

    The Ext.ux.data.PagingStore class is a drop-in extension for the Ext.data.Store class. Local paging should work directly after replacing the reference to Store with PagingStore (there are also similar replacements for DirectStore, JsonStore, XmlStore and ArrayStore/SimpleStore).

    Example of a remote store:
    Code:
    var store = new Ext.ux.data.PagingArrayStore({
        fields: [...],
        url: 'data.php',
        autoLoad: {params: {start: 0, limit: 10}}
    });
    Example of a local store:
    Code:
    var store = new Ext.ux.data.PagingArrayStore({
        fields: [...],
        data: data,
        lastOptions: {params: {start: 0, limit: 10}}
    });
    Just one note:
    If you load a PagingStore it will ONLY request new data if any of the parameters (except start and limit) were changed from the previous load (otherwise it will just show a different page of the same data).
    If you want to force a load you need to delete the lastParams property before loading the store.

    Example: To make the refresh button of the paging toolbar do a forced reload you would need:
    Code:
    Ext.override(Ext.PagingToolbar, {
        doRefresh: function(){
            delete this.store.lastParams;
            this.doLoad(this.cursor);    
        }
    });
    Note: In Ext 3.0 and 3.1 the doRefresh method is called 'refresh'.

    Version history:
    0.4:
    - First release for Ext 3.0
    0.4.1:
    - Fixed destroy bug
    - Last release for Ext 3.0 and 3.1
    0.5:
    - Only for Ext 3.2 (and up?).
    - Added PagingGroupingStore (although I don't recommend using it).
    - Added Ext.ux.PagingToolbar with doRefresh patch and support for adding/removing/clearing records.

    The Ext 2.x version can be found here.
    Attached Files
    Last edited by Condor; 29 May 2010 at 6:08 AM. Reason: v0.5

  2. #2
    Sencha User galdaka's Avatar
    Join Date
    Mar 2007
    Location
    Spain
    Posts
    1,166
    Vote Rating
    -1
    galdaka is an unknown quantity at this point

      0  

    Default


    Quote Originally Posted by Condor View Post
    Ext 3.0 natively only supports remote paging (the server needs to process the start and limit parameters).
    ...
    Hi,

    And where is the code?

    Greetings,

  3. #3
    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


    Strange, my attachment must have gotten lost somewhere... I added it again.

  4. #4
    Ext User
    Join Date
    Nov 2007
    Posts
    68
    Vote Rating
    0
    markpele is an unknown quantity at this point

      0  

    Default


    Why did you choose the name lastOptions? I would choose something like localLoad which is the local analog to autoLoad. I'm asking because your choice of this name probably means that it is not a simple local analog.

    Is it possible to combine remote and local stores?
    I'm trying to load large sets of data from a remote server - 100 records
    and use local paging of small pages with 4 records.
    At start the store will load the first 100 records. The user will be able to page and see records 1-4, 5-8...97-100 locally but if he'll ask for the 101s record the store will automatically load the next 100 records from the server. If we use caching moving from record 100 to 101 should feel smooth.

  5. #5
    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


    1. lastOptions is not a property I created. It is already part of the current Store code and used to store the options used for the last load() call.

    2. You would have to write some extra code for that.
    - Detect if a load needs data that hasn't been loaded yet.
    - Load the extra data using an Ajax request and create records from it using the reader.
    - Join the records to the store and add them to allData.
    - Apply paging and fire a datachanged event.

  6. #6
    Ext JS Premium Member
    Join Date
    Nov 2008
    Posts
    53
    Vote Rating
    0
    828 is on a distinguished road

      0  

    Default


    Condor,

    Getting "zip file currupt" when downloading.

  7. #7
    Sencha User
    Join Date
    Mar 2010
    Location
    India
    Posts
    10
    Vote Rating
    0
    Arindam Das is on a distinguished road

      0  

    Question


    Quote Originally Posted by Condor View Post
    2. You would have to write some extra code for that.
    - Detect if a load needs data that hasn't been loaded yet.
    - Load the extra data using an Ajax request and create records from it using the reader.
    - Join the records to the store and add them to allData.
    - Apply paging and fire a datachanged event.
    Condor,
    Is this already done in another component? If not do you mean to say that I write the above extra code modifying your paging store or should I start fresh by extending the Store itself.

    Thanks for the great work

  8. #8
    Ext User
    Join Date
    Mar 2008
    Posts
    10
    Vote Rating
    0
    dhisnotnull is on a distinguished road

      0  

    Post Minor fix

    Minor fix


    Quote Originally Posted by Condor View Post

    this doesnt work in 3.0 Final

    Code:
    Ext.override(Ext.PagingToolbar, {
        onRefreshClick: function(){
            delete store.lastParams;
            this.doLoad(this.cursor);    
        }
    });
    should be

    Code:
    Ext.override(Ext.PagingToolbar, {
        refresh: function(){
            delete this.store.lastParams;
            this.doLoad(this.cursor);    
        }
    });
    Nice component by the way, helped me alot .

  9. #9
    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


    Quote Originally Posted by dhisnotnull View Post
    should be
    Good catch. I adjusted the first post.

  10. #10
    Sencha User steffenk's Avatar
    Join Date
    Jul 2007
    Location
    Haan, Germany
    Posts
    2,663
    Vote Rating
    6
    steffenk has a spectacular aura about steffenk has a spectacular aura about steffenk has a spectacular aura about

      0  

    Default


    Hi Condor,

    Many thanks for the Ext! This is exactly what i needed after struggling with huge xml file.

    Here it's in action:
    http://dev.sk-typo3.de/cetest/svn-log.html
    vg Steffen
    --------------------------------------
    Release Manager of TYPO3 4.5

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..."