1. #1
    Sencha User
    Join Date
    Aug 2009
    Posts
    122
    Vote Rating
    0
    bauchinj is on a distinguished road

      0  

    Default Problem with direct

    Problem with direct


    Hello!

    I've got a problem with some Code...

    Given is a treepanel, which has included "folders". Because of big amount of "files" it's an option to show them. When user show "files", I load nodes when expanding. Server-Side it's like following: a file is created which includes all data (called with ajax request). When success, a polling-provider starts to get the first 100 entries. When request, provider stop, output all data and configure the url and start again with new parameter. Now the next 100 entries get loaded.
    Now the Problem: first 2 direct-calls are sucessfully, but next time, node isn't known and "files" aren't shown. So what can be the problem? Why does JS "loose" the node-object?
    The action is started on event 'expandnode' in treepanel.

    Hope someone can help me!

    bauchinj

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,704
    Vote Rating
    751
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Wouldn't know without seeing code.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Aug 2009
    Posts
    122
    Vote Rating
    0
    bauchinj is on a distinguished road

      0  

    Default Code

    Code


    Ok, here the code snippet:

    Code:
    Container.add({
        id            : 'someId',
        border        : false,
        width        : 700,
        style        : {
             textAlign    : 'left'
        },    
        defaults    : {
            border    : false,
        },
        items        : [{
            xtype        : 'treepanel',
            id            : 'treeId',
            rootVisible    : false,
            autoScroll    : true,
            root        : {
                nodeType    : 'async'
            },
            loader        : {
                url            : 'functions/getTree.php',
                baseParams    :{
                     id         : 'treeLoader',
                     root    : ''
                }
            },
            listeners    : {
                'expandnode'    : function(node){
                    var    getChildNodes = node.findChild('cls','file');
                     if(getChildNodes == null){
                        var nodeChecked = node.getUI().isChecked();
                        var showFiles = Ext.getCmp('showFiles').getValue();
                        if(showFiles){
                             var waitNode = new Ext.tree.TreeNode({
                                id        : 'waitNode',
                                text    : "Wait...",
                                leaf    : true,
                                cls        : 'waitNode'
                            });
                            node.appendChild(waitNode);
                            Ext.Ajax.request({
                                url        : 'functions/get_set.php',
                                params    : {
                                    action    : 'filesOfFolder',
                                    dir        : node.id,
                                    checked    : nodeChecked,
                                    source    : showFilesAction
                                },
                                success    : function(response){
                                     var first = 0;
                                     var last = 199;
                                     
                                     var fofProvider = new Ext.direct.PollingProvider({
                                        type        : 'polling',
                                        url            : 'functions/outputFof.php?folder='+node.id+'&first='+first+'&last='+last,
                                        interval    : '1000',
                                        id            : 'fofProvider'
                                    });
                                    Ext.Direct.on('message', function(e){
                                         if(fofProvider.isConnected()){
                                            var respText = e.data;
                                            if(respText == "finished"){
                                                 fofProvider.disconnect();
                                                node.removeChild(waitNode,true);            
                                            }
                                            else{
                                                 fofProvider.disconnect();
                                                 getChildNodes = node.findChild('cls','file');
                                                 
                                                 if(getChildNodes == null){
                                                     var checked = node.checked;
                                                     if(respText != "" && respText != "[]"){
                                                         var jsonNode = eval("({nodes:" + respText + "})");
                                                         var jsonArrayCt = jsonNode.nodes.length;
                                                         var newNodes;
                                                         for(var i = 0; i < jsonArrayCt; i++){
                                                             newNode = new Ext.tree.TreeNode(jsonNode.nodes[i]);
                                                            node.appendChild(newNode);
                                                        }
                                                    }
                                                }
                                                
                                                first += 200;
                                                last += 200;
                                                fofProvider.url = 'functions/outputFof.php?folder='+node.id+'&first='+first+'&last='+last;
                                                fofProvider.connect();
                                            }
                                        }
                                    });
                                    Ext.Direct.addProvider(fofProvider);
                                },
                                failure    : function(response){
                                    node.removeChild(waitNode);
                                }
                            });
                        }
                    }
                }
            }
        }]
    });

Thread Participants: 1

Tags for this Thread

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar