PDA

View Full Version : Tree dragdrop not working using IE



liotrox
5 Jan 2007, 1:22 AM
Hi,

using this code:



function initTree()
{
var Tree = YAHOO.ext.tree;

var tree = new Tree.TreePanel('treeContainer',
{
animate : false,
enableDD : true,
containerScroll: true,
loader: new Tree.TreeLoader({ dataUrl: LX.Ajax.pageMethodURL('getTreeNodes') })
});

// set the root node
var root = new Tree.AsyncTreeNode(
{
id : 'Z:/',
text : 'Z:/',
draggable: false
});
tree.setRootNode(root);


// render the tree
tree.render();

// false for not recursive (the default), false to disable animation
root.expand();

//tree.getSelectionModel().on('selectionchange', showFileDetails, tree, true);
tree.getSelectionModel().select(root);
tree.on('click', function showFileDetails(node)
{
LX.Ajax.callMethod('getFileDetails', {file: node.id}, function(r)
{
if(!r.value) return;

$('fileInfo').innerHTML = "<pre>" +
"Path : " + node.id + "
" +
"Size : " + r.value.size + "
" +
"Updated: " + r.value.date + "
</pre>";
}, 'ajax1');
});

// Add an inline editor for the tree nodes
var inlineEditor = new YAHOO.ext.InlineEditor(
{
container: tree.getEl(),
multiline: false
});

tree.on('beforeclick', function(node)
{
if(tree.getSelectionModel().isSelected(node))
{
inlineEditor.startEdit(node.ui.textNode);
return false;
}
});
}


YAHOO.ext.EventManager.onDocumentReady(window.initTree, window, true);

<div id="treeContainer" style="overflow:auto; width: 350px; height: 500px; border: 1px solid navy; float:left; padding: 5px;">
</div>
<div id="fileInfoContainer" style="width: 450px; height: 500px; border: 1px solid navy; float:left; padding: 5px;">
File Details <xc:ajaxProgressIndicator name="ajax1" />
<hr>
<span id="fileInfo" style="color:blue"></span>
</div>



the dragdrop is not working at all using IE (is working fine using FireFox 2.0).
When dragging a node with IE the mouse feedback is alway 'no-drop' zone.

BYE
Angelo

jack.slocum
5 Jan 2007, 9:11 AM
The construct below is illegal:

tree.on('click', function showFileDetails(node)
{
LX.Ajax.callMethod('getFileDetails', {file: node.id}, function(r)
{

Try:


tree.on('click', function (node)
{
LX.Ajax.callMethod('getFileDetails', {file: node.id}, function(r)
{

liotrox
8 Jan 2007, 1:13 AM
Hi Jack,

thanks for your reply. I modified my code as:



<script>
function initTree()
{
var Tree = YAHOO.ext.tree;

var tree = new Tree.TreePanel('treeContainer',
{
animate : false,
enableDD : true,
containerScroll: true,
loader: new Tree.TreeLoader({ dataUrl: LX.Ajax.pageMethodURL('getTreeNodes') })
});

// set the root node
var root = new Tree.AsyncTreeNode(
{
id : 'Z:/',
text : 'Z:/',
draggable: false
});
tree.setRootNode(root);


tree.render();

root.expand();

tree.getSelectionModel().select(root);

tree.getSelectionModel().on('selectionchange', function(treePanel, node)
{
LX.Ajax.callMethod('getFileDetails', {file: node.id}, function(r)
{
if(!r.value) return;

$('fileInfo').innerHTML = "<pre>" +
"Path : " + node.id + "
" +
"Size : " + r.value.size + "
" +
"Updated: " + r.value.date + "
</pre>";
}, 'ajax1');
});

// Add an inline editor for the tree nodes
var inlineEditor = new YAHOO.ext.InlineEditor(
{
container: tree.getEl(),
multiline: false
});

tree.on('beforeclick', function(node)
{
if(tree.getSelectionModel().isSelected(node))
{
inlineEditor.startEdit(node.ui.textNode);
return false;
}
});

}

YAHOO.ext.EventManager.onDocumentReady(window.initTree, window, true);

</script>

<div id="treeContainer" style="overflow:auto; width: 350px; height: 500px; border: 1px solid navy; float:left; padding: 5px;">
</div>
<div id="fileInfoContainer" style="width: 450px; height: 500px; border: 1px solid navy; float:left; padding: 5px;">
File Details <xc:ajaxProgressIndicator name="ajax1" />
<hr>
<span id="fileInfo" style="color:blue"></span>
</div>



Now the 'selectionchange' event is working fine. DragDrop is working ok with FireFox but still doing nothing on IE...

What I did wrong? (because, of course, in the blog examples IE is working fine...)

Thanks
Angelo

jack.slocum
8 Jan 2007, 11:26 AM
I don't see it. Any chance of a link?