Page 10 of 10 FirstFirst ... 8910
Results 91 to 96 of 96

Thread: [1.1] Ext.ux.data.PagingMemoryProxy

  1. #91

    Default Need delete record delete all record

    hello, please help need a way to delete a record and remove all record when using PagingMemory Proxy

    I tried using removeAll method of store but it doesn't work

    Thanks in advance

  2. #92
    Ext User
    Join Date
    Jun 2009
    Location
    South Moravia, CZ
    Posts
    3

    Default Thanx!

    Quote Originally Posted by talshadar View Post
    I tracked down the paging error. It was how I was declaring the value for the records per page:

    This is what I had:
    Code:
            thumbsPagingToolbar = new Ext.PagingToolbar(viewThumbsFooter, dsImageThumbs, {
                pageSize: "30",
                displayInfo: true,
                displayMsg: 'Rows {0} - {1} of {2}',
                emptyMsg: "No records to display"
            });
    I removed the quotes around the pageSize:
    Code:
            thumbsPagingToolbar = new Ext.PagingToolbar(viewThumbsFooter, dsImageThumbs, {
                pageSize: 30,
                displayInfo: true,
                displayMsg: 'Rows {0} - {1} of {2}',
                emptyMsg: "No records to display"
            });
    And boom it works!!! So yay! My holiday is starting off great!!
    Thank You talshadar! I've been having exactly the same problem! I tried everything i could possibly think of, but with no success. Never thought it could be so trivial (LOL)
    Thanx again..

  3. #93

    Default

    I'm glad you figured it out. That's one of the things that drives me nuts about extJS - it can be the simplest tiniest thing that you just can't find. I'm spoiled I guess, PHP has the best documentation I've ever found and I keep wishing extJS was the same. I've given up so many times on resolving issues because of the lack, in my opinion, of real complete examples and documentation. Just one of my pet peeves.

  4. #94

    Default

    I ran into a problem with using this. My use case is that I have no access to the remote server, and the remote server does not do paging. It just sends me a lump of anywhere from 0 to 100 rows depending. My viewing space is limited as well, so I can't show a potential 100 rows all at once.

    Then, the remote server is also slow. But again, I have no control over it and I have to use it. So rather than refresh everything when a change is made, I wanted to send the change to the server and then just update my local copy of the data. A callback on the submit request would tell me if the update was successful, and when I get that it was successful I can update the records.

    But then the proxy doesn't store the records. It stores the original data. The records in my case are a Json store, and some of the original properties can be mapped elsewhere.

    I made this function, and it works for me, but please tell me if I'm dumb and there was a better way to do this all along, etc. If its useful to your situation, please feel free to use it, just know that it may have sharp edges as I've only been using Javascript for a few weeks.

    Code:
        // Update our copy of the store with new data.
        update: function (records, store, idProperty) {
            var count = 0;
            var result = '';
            
            // Check to see if the idProperty is mapped to something else.
            var oID = store.reader.recordType.getField(idProperty).mapping;
            if (oID == null || oID == undefined) {
                oID = idProperty;
            }
            
            // Is this an array of records, or a single record? Recurse through an array.
            if (typeof(records) == 'array') {
                while (records[count] != undefined) {
                    this.update(records[count], store, idProperty);
                    count = count + 1;
                }
            }
            
            // This is just a single object
            if (typeof(records) == 'object') {
                while (this.data.results[count] != undefined) {
                    // Does this record match the ID property we are looking for?
                    if (this.data.results[count][oID] == records['data'][idProperty]) {
                        // Start copying over the data, preserve mappings.
                        for (var property in records['data']) {
                            // Check for a mapping.
                            var oProperty = store.reader.recordType.getField(property).mapping;
                            if (oProperty == null || oProperty == undefined) {
                                if (this.data.results[count][property] != undefined) {
                                    oProperty = property;
                                } else {
                                    // There is no mapping, and no correlating property in the original data. Ignore and proceed.
                                    continue;
                                }
                            }
                            this.data.results[count][oProperty] = records['data'][property];
                        }
                        return true;
                    }
                    count = count + 1;
                }
            }
            return false;
        }
    It goes inside the PagingMemoryProxy class.

  5. #95
    Ext Premium Member yyogev's Avatar
    Join Date
    Jun 2009
    Location
    Shoham, Israel
    Posts
    196

    Default Fix to PagingMemoryProxy for ExtJS 3.0

    Hi,

    I tried using PagingMemoryProxy 3.0 RC2, and found out it was not called, as it was overriding load(), but doRequest() is now called in proxy.

    The code is pretty much the same, with a little update in the exception handling copied from the MemoryProxy code.

    HTH,
    Yaron Yogev
    Attached Files Attached Files

  6. #96

    Red face The same records are in all of the pages in my paging toolbar

    Hello,

    I'm trying to paginate the results in a search. The result is shown in a GridPanel, and I am using PagingMemoryProxy to paginate in local mode.
    The problem is that the same first fetched results appear in all of the pages in the grid, althought the bottom toolbar change.

    This is my relevant code:

    Code:
    var busquedaRecord = new Ext.data.Record.create([  
         {name: 'codIG', type: 'string'},  
         {name: 'aplicacion', type: 'string'},  
         {name: 'proceso', type: 'string'},
         {name: 'estado', type: 'string'},  
         {name: 'criticidad', type: 'string'},  
         {name: 'descripcion', type: 'string'},
         {name: 'fecha', type: 'date', format: 'd/m/Y'} 
    ]); 
        
    
    var arrayReaderJson = new Ext.ux.data.JsonArrayReader({
        root : 'items',        
        totalProperty : 'rowNumber'
    },busquedaRecord
    
    );    
    
    var result = new Ext.data.JsonStore({    
        proxy: new Ext.ux.data.PagingMemoryProxy(),
      reader: arrayReaderJson
    });
    
    var columns = [
       {header: "Código IG", width: 70, sortable: true, dataIndex: 'codIG'},
       {header: "Aplicación", width: 75, sortable: true, dataIndex: 'aplicacion'},
       {header: "Proceso", width: 75, sortable: true, dataIndex: 'proceso'},
       {header: "Estado", width: 75, sortable: true, dataIndex: 'estado'},
       {header: "Criticidad", width: 70, sortable: true, dataIndex: 'criticidad'},
       {id:'descripcion',header: "Descripción", width: 250, sortable: true, dataIndex: 'descripcion'},
       {header: "Fecha creación", width: 85, sortable: true, renderer: Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'fecha'}
    ];
    
    var paging = new Ext.PagingToolbar({  
        pageSize: 5, 
        store: result, 
        displayInfo: true,   
        displayMsg: 'Mostrando  {0} - {1} de {2}',  
        emptyMsg: "No existen datos"   
    });
    
    var busquedaGrid = new Ext.grid.GridPanel({
        view: new Ext.grid.GridView(),
        store : result,
      columns: columns,
      autoExpandColumn: 'descripcion',
      bbar :  paging,
      height:250,
      width:600
    });
    
    var frmIzq = new Ext.FormPanel ({
    
       ...
            buttons :[{
                text: 'Buscar',
                   iconCls : 'silk-magnifier',
                   handler : function(){
                    if(frmIzq.getForm().isValid()){
                        frmIzq.getForm().submit({
                            url: 'ServletBuscar',
                            method:'POST',
                            failure: ...  
                            success: function (form, request) {  
                                result= new Ext.data.Store({
                                    reader : arrayReaderJson,
                                    proxy: new Ext.ux.data.PagingMemoryProxy(Ext.util.JSON.decode(request.response.responseText))
                                });                              
                                busquedaGrid.store = result;
                          
                                paging.bindStore(busquedaGrid.getStore());
                                busquedaGrid.footer = paging;
                                 
                                busquedaGrid.render(); 
                                result.load({params:{start:0, limit:5}});
                                  
                                busquedaGrid.store.commitChanges();
                                busquedaGrid.getView().refresh();
                            }
                        });
                        
                    }
                 }
             }
    });
    all of this code is in a class Ext.Panel, that is invoked from ready function, inside on a Ext.Viewport var.

Page 10 of 10 FirstFirst ... 8910

Posting Permissions

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