1. #21
    Sencha - Community Support Team hendricd's Avatar
    Join Date
    Aug 2007
    Location
    Long Island, NY USA
    Posts
    5,963
    Vote Rating
    10
    hendricd will become famous soon enough hendricd will become famous soon enough

      0  

    Default


    @WBarnie - Have you seen this one too? Dunno if it applies tho.
    "be dom-ready..."
    Doug Hendricks

    Maintaining ux: ManagedIFrame, MIF2 (FAQ, Wiki), ux.Media/Flash, AudioEvents, ux.Chart[Fusion,OFC,amChart], ext-basex.js/$JIT, Documentation Site.


    Got Sencha licensing questions? Find out more here.


  2. #22
    Ext User
    Join Date
    Dec 2007
    Location
    Oxford, MA
    Posts
    83
    Vote Rating
    0
    WBarnie is on a distinguished road

      0  

    Default


    If I understand your last response, the PagingMemoryProxy only works with array readers. I have reviewed the documentation trying to figure out how to make a JsonReader an ArrayReader. We are using a JsonStore and the root element is the array of data. I tried this and I do not get any error and the display is still wrong. Also I do not understand why all rows are displayed when I specify a limit of 25? I am using fire fox and tried to debug the problem. I set several break point in PagingMemoryProxy not of them were hit. I question whether or not I have set this up correctly. I down loaded the PagingMemoryProxy and added 2 folders, ux and data.

  3. #23
    Sencha - Community Support Team hendricd's Avatar
    Join Date
    Aug 2007
    Location
    Long Island, NY USA
    Posts
    5,963
    Vote Rating
    10
    hendricd will become famous soon enough hendricd will become famous soon enough

      0  

    Default


    Quote Originally Posted by WBarnie View Post
    If I understand your last response, the PagingMemoryProxy only works with array readers.
    Correct - Arrays only.

    But, what does your JSON response look like? Is the array data in there somewhere? Just pass that array to the Proxy.
    "be dom-ready..."
    Doug Hendricks

    Maintaining ux: ManagedIFrame, MIF2 (FAQ, Wiki), ux.Media/Flash, AudioEvents, ux.Chart[Fusion,OFC,amChart], ext-basex.js/$JIT, Documentation Site.


    Got Sencha licensing questions? Find out more here.


  4. #24
    Ext User
    Join Date
    Dec 2007
    Location
    Oxford, MA
    Posts
    83
    Vote Rating
    0
    WBarnie is on a distinguished road

      0  

    Default


    yes the array is in the jsonReader, jsonData.rows is thew data array. Going through the debugger, I can see jsonReader.jsonData.rows in the debugger, but when I try to reference it, I get not defined error. Not sure why perhaps this is private data?

  5. #25
    Ext User mrollins's Avatar
    Join Date
    Jan 2008
    Posts
    32
    Vote Rating
    0
    mrollins is on a distinguished road

      0  

    Default PagingMemoryProxy and EditorGrids

    PagingMemoryProxy and EditorGrids


    Hey, thanks for the great addon. We're really getting a lot of use out of it.

    So far, we've only used PMP on GridPanels, but now we're needing to use a PMP on an EditorGrid. All the data is being served up correctly, but we have a problem when update a record or add a new one.

    When I add a new record, enter some values for it, then sort my grid, the new record is disappearing. The same thing occurs when I edit an existing record, except that the edits disappear (but the record stays).

    I'm thinking that I may need to send the new record or edits back to the proxy (we're using remote sorting and remote filtering). Right now, when I add a new record, I do this (the insert is in red):

    Code:
    {
                        text: 'Add',
                        handler: function(){
                            var r = new Record({});
                            grid.stopEditing();
                            store.insert(0, r);
                            grid.startEditing(0, 0);
                        }
                    }
    Do I need to add the new record to the proxy, as well? Do I need to push any edits up to the PMP, also?

    Thanks in advance.

  6. #26
    Sencha - Community Support Team hendricd's Avatar
    Join Date
    Aug 2007
    Location
    Long Island, NY USA
    Posts
    5,963
    Vote Rating
    10
    hendricd will become famous soon enough hendricd will become famous soon enough

      0  

    Default


    @mrollins -- Yes, ultimately you have to do the same thing you would with a real server. The PMP is, in essence, your server. Currently PMP is coded for read-only use, so you must update/append each row in the proxy.data array when you commit the store changes.
    "be dom-ready..."
    Doug Hendricks

    Maintaining ux: ManagedIFrame, MIF2 (FAQ, Wiki), ux.Media/Flash, AudioEvents, ux.Chart[Fusion,OFC,amChart], ext-basex.js/$JIT, Documentation Site.


    Got Sencha licensing questions? Find out more here.


  7. #27
    Sencha - Community Support Team mankz's Avatar
    Join Date
    Nov 2007
    Location
    Stockholm, Sweden
    Posts
    2,810
    Vote Rating
    133
    mankz is a splendid one to behold mankz is a splendid one to behold mankz is a splendid one to behold mankz is a splendid one to behold mankz is a splendid one to behold mankz is a splendid one to behold

      0  

    Default


    I'm also trying this approach, loading 300 records into the PagingMemProxy and performing a full update (based on your code snippets below) if users modifies a record.

    What happens to memory when you do the following:

    Code:
    ds.proxy.data = Ext.decode(response.responseText);
    Is there a memory leak here caused by old data not being deleted before being overwritten?
    I.e. do I need to do

    Code:
    delete ds.proxy.data;
    first?

    Quote Originally Posted by hendricd View Post
    Since you are using PagingMemProxy merely as a local cache of the entire server response, you need only give the PagingMemProxy it's array data when you decide to query the server again:

    Code:
    var driveInGrid = function() {
    var ds;
    var grid;
    var cm;
    var paging;
    var gridFoot;
    var serverObj = new Ext.data.Connection();
    
    function setupDataSource(){
         ds = new Ext.data.Store({
                 proxy: new Ext.ux.data.PagingMemoryProxy([]),  //start out empty
                 id: 'getAppraisalId',
                 reader: new Ext.data.ArrayReader({}, [
                    {name: 'getAppraisalNumber' },
                    {name: 'getAppraisalId' },
                    {name: 'getVehicleModel'},
                     ............
    
                   ]),
                 remoteSort: true
              });
           
    }
    
    
    
    return {
            init : function() {
                setupDataSource();
                buildGrid();
                setupButtons();
                this.load();
            },
            load : function(url,params){
               params || (params = {userAction:'list' ,searchType:document.forms[0].searchType.value, searchValue:document.forms[0].searchValue.value});
                serverObj.request({
                     url: url || 'DriveInListingAction.do',
                     method :'GET', 
                     params : params,
                     success: function(response){
                          //give the proxy the entire array result set
                          ds.proxy.data = Ext.decode(response.responseText);
                          //now, let your paging Store and local Proxy take over 
                          ds.load({params:{ start:0, limit:25}});
                     },
                     failure: youHandleIt
                  });
            },        
            getDataSource: function() {
                return ds;
            }
    };
    To reload from the server again just call (optionally, without any arguments):
    Code:
    driveInGrid.load()
    again when you need to.

    Is that what you're looking to do? If you send back arrays instead of JSON records you're all set.

  8. #28
    Sencha - Community Support Team hendricd's Avatar
    Join Date
    Aug 2007
    Location
    Long Island, NY USA
    Posts
    5,963
    Vote Rating
    10
    hendricd will become famous soon enough hendricd will become famous soon enough

      0  

    Default


    Quote Originally Posted by mankz View Post
    I'm also trying this approach, loading 300 records into the PagingMemProxy and performing a full update (based on your code snippets below) if users modifies a record.

    What happens to memory when you do the following:

    Code:
    ds.proxy.data = Ext.decode(response.responseText);
    Is there a memory leak here caused by old data not being deleted before being overwritten?
    I.e. do I need to do

    Code:
    delete ds.proxy.data;
    first?
    It's certainly not required, but may not be a bad idea either.
    "be dom-ready..."
    Doug Hendricks

    Maintaining ux: ManagedIFrame, MIF2 (FAQ, Wiki), ux.Media/Flash, AudioEvents, ux.Chart[Fusion,OFC,amChart], ext-basex.js/$JIT, Documentation Site.


    Got Sencha licensing questions? Find out more here.


  9. #29
    Sencha - Community Support Team mankz's Avatar
    Join Date
    Nov 2007
    Location
    Stockholm, Sweden
    Posts
    2,810
    Vote Rating
    133
    mankz is a splendid one to behold mankz is a splendid one to behold mankz is a splendid one to behold mankz is a splendid one to behold mankz is a splendid one to behold mankz is a splendid one to behold

      0  

    Default


    Would sIEve detect this (if in fact it was a leak) or is it more concerned with orphaned dom elements etc?

  10. #30
    Sencha - Community Support Team hendricd's Avatar
    Join Date
    Aug 2007
    Location
    Long Island, NY USA
    Posts
    5,963
    Vote Rating
    10
    hendricd will become famous soon enough hendricd will become famous soon enough

      0  

    Default


    Yes, sIeve focuses on DOM linkage.
    "be dom-ready..."
    Doug Hendricks

    Maintaining ux: ManagedIFrame, MIF2 (FAQ, Wiki), ux.Media/Flash, AudioEvents, ux.Chart[Fusion,OFC,amChart], ext-basex.js/$JIT, Documentation Site.


    Got Sencha licensing questions? Find out more here.