Results 1 to 10 of 285

Thread: [v0.5]

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    The Netherlands
    Vote Rating

    Cool [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 class is a drop-in extension for the 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:
    var store = new{
        fields: [...],
        url: 'data.php',
        autoLoad: {params: {start: 0, limit: 10}}
    Example of a local store:
    var store = new{
        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:
    Ext.override(Ext.PagingToolbar, {
        doRefresh: function(){
    Note: In Ext 3.0 and 3.1 the doRefresh method is called 'refresh'.

    Version history:
    - First release for Ext 3.0
    - Fixed destroy bug
    - Last release for Ext 3.0 and 3.1
    - 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 Attached Files
    Last edited by Condor; 29 May 2010 at 6:08 AM. Reason: v0.5

Posting Permissions

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