You found a bug! We've classified it as EXTJSIV-8526 . We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1
    Sencha User
    Join Date
    Apr 2007
    Posts
    159
    Vote Rating
    0
    vladsch is on a distinguished road

      0  

    Default [4.2.0.265] Strange behaviour after TreeStore reloading (TreeStore with proxy)

    [4.2.0.265] Strange behaviour after TreeStore reloading (TreeStore with proxy)


    REQUIRED INFORMATION


    Ext version tested:
    • Ext 4.2.0 rev 265

    Browser versions tested against:
    • Chrome
    • IE9

    DOCTYPE tested against:
    • <!DOCTYPE html>

    Description:
    • If call reload method of TreeStore then strange behaviour can be observed: many nodes are duplicated

    Steps to reproduce the problem:
    • Open the following test case and click Refresh button. For test case I used memory proxy with read method override, in that override I added defer 1000 ms, without that override Chrome is crashed after Refresh click (IE9 shows js error - Stack maximum overflow)
    • If remove nodes ids then duplication behaviour is different

    The result that was expected:
    • Behaviour after reloading should not be different

    The result that occurs instead:
    • Tree starts to duplicate nodes

    Test Case:

    Code:
        <!DOCTYPE html>
    <html>
    <head>
        <title></title>    
    	<link rel="stylesheet" type="text/css" href="../../resources/css/ext-all.css" />
    	<script type="text/javascript" src="../../ext-all.js"></script>	
    
    	<script type="text/javascript">
    		function read(operation, callback, scope) {
    			Ext.defer(function(){
    			var me = this,
    				resultSet = operation.resultSet = me.getReader().read(me.data),
    				records = resultSet.records,
    				sorters = operation.sorters,
    				filters = operation.filters;
    
    			operation.setCompleted();
    
    			// Apply filters, sorters, and start/limit options
    			if (resultSet.success) {
    
    				// Filter the resulting array of records
    				if (filters && filters.length) {
    					records = resultSet.records = Ext.Array.filter(records, Ext.util.Filter.createFilterFn(filters));
    				}
    
    				if (sorters && sorters.length) {
    					resultSet.records = Ext.Array.sort(records, Ext.util.Sortable.createComparator(sorters));
    				}
    
    				// Reader reads the whole passed data object.
    				// If successful and we were given a start and limit, slice the result.
    				if (me.enablePaging && operation.start !== undefined && operation.limit !== undefined) {
    
    					// Attempt to read past end of memory dataset - convert to failure
    					if (operation.start >= resultSet.total) {
    						resultSet.success = false;
    						resultSet.count = 0;
    						resultSet.records = [];
    					}
    					// Range is valid, slice it up.
    					else {
    						resultSet.records = Ext.Array.slice(resultSet.records, operation.start, operation.start + operation.limit);
    						resultSet.count = resultSet.records.length;
    					}
    				}
    			}
    			
    			
    				if (resultSet.success) {
    					operation.setSuccessful();
    				} else {
    					me.fireEvent('exception', me, null, operation);
    				}
    				Ext.callback(callback, scope || me, [operation]);
    			}, 1000, this);			
    		}
    	
    		Ext.onReady(function () {
    			var tree = Ext.create("Ext.tree.Panel", {
    				store: {					
    					type: "tree",
    					proxy : {
    						type: "memory",
    						read : read,
    						data : {
    							"children": [{
    								"id": "node1",
    								"expanded": true,								
    								"text": "Node 1 634956848574517153",
    								"children": [{
    									"id": "node2",									
    									"text": "Node 2",
    									"children": [{
    										"id": "node3",
    										"leaf": true,										
    										"text": "Node 3"
    									}]
    								}]
    							}]
    						}
    					}
    				},				
    				height: 400,
    				renderTo: document.body,
    				tbar: {					
    					"xtype": "toolbar",
    					items: [{						
    						text: "Refresh",
    						handler: function () {
    							tree.store.reload();
    						}
    					}]
    				},				
    				rootVisible: false
    			});
    		});
        </script>
    	
    </head>
    <body>
    </body>
    </html>


    HELPFUL INFORMATION

    Debugging already done:
    • none

    Possible fix:
    • not provided

    Additional CSS used:
    • only default ext-all.css

    Operating System:
    • Win7
    Ext.NET - ASP.NET for Ext JS
    MVC and WebForms
    Examples | Twitter

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,641
    Vote Rating
    434
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    Thanks for the report! I have opened a bug in our bug tracker.