Results 1 to 3 of 3

Thread: Setting a dataURL for a TreePanel's loader dynamically

  1. #1
    Ext JS Premium Member
    Join Date
    Aug 2009
    Posts
    250

    Default Setting a dataURL for a TreePanel's loader dynamically

    Hello,

    I have created a window object which uses a TreePanel.
    I would like to set the dataURL of the treePanel's loader object dynamically.

    Below is my code, with a static dataURL:

    Code:
    copyWindow = Ext.extend(Ext.Window, {
      title: 'copy',
      layout: 'fit',
      buttonAlign: 'center',
      initComponent: function() {
        copyWindow.superclass.initComponent.call(this);
     
        var Tree = Ext.tree;
        var root = new Tree.AsyncTreeNode({
          text: 'Departments',
          draggable: false,
          expanded: true,
          rootVisible: false,
          id: 'source'
        });
     
        this.treePanel = new Tree.TreePanel({
          autoScroll: true,
          animate: true,
          lines: true,
          containerScroll: true,
          loader: new Tree.TreeLoader({
            dataUrl: 'WS.asmx/GetGroups'
     
        }),
     
      root: root,
      rootVisible: false
    });
     
     
    this.add(this.treePanel);
     
    });
    When creating a window object (var win = new copyWindow()),

    How can I set the dataURL?

    Thanks

  2. #2
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,245

    Default

    Code:
    copyWindow.treePanel.getLoader().dataUrl = 'newurl';
    (and I assume you want to reload the root node after that?)

  3. #3
    Ext JS Premium Member
    Join Date
    Aug 2009
    Posts
    250

    Default

    Thanks for your reply.

    Eventualy, I used the following:

    Code:
    var dataUrl = 'myURL';
    var title = 'myTitle'
     
    var win = new copyWindow({ dataUrl: dataUrl, title: title});
    win.show();
    
    I have a new problem though - when selecting nodes in the window's tree and pressing a 'copy' button, I am trying to fetch all of the selected nodes.
    The problem is that I always get the first selected node ONLY.

    Here is the relevant code:

    Code:
    var copyButton = new Ext.Button({
     text: 'copy',
     scope: this,
     minWidth: 75,
     handler: this.onCopy
    });
     
    onCopy: function() {
     var nodes = this.treePanel.getSelectionModel().getSelectedNodes();
    
    }
    
    'nodes' contain only 1 node, even though I selected more.

    Please let me know if I should open a new thread for that.

    Thank you

Posting Permissions

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