开发者

Create external call to jquery File Tree bindTree function

I am trying to create a text box to go along with the jquery fi开发者_开发问答le tree and I would like to pass the input text to the bindTree function in the .js file in order to open the corresponding folder when submitting the drive text. I am a little stuck as I am fairly new to javascript etc.

The function in question is nested within $.extend and $(this).each calls which I assume is the reason why I cannot flat out call the bindTree function in my code.

Any pointers would be greatly appreciated.

Peace


The easiest way to do this is making a button that re-call the $.fn.filetree() and send the param of the root dir. For example:

The button and text input:

<input type="text" id="txtDir" />
<input type="button" id="btnDir" value="View" />

And make a simple script:

$("#btnDir").click(function(){
    var root  = $("#txtDir").attr("value");
    $('#fileTreeDemo_1').fileTree({ root: root, script: 'jqueryFileTree.php' }, function(file) { 
        alert(file);
    });
});

It will work, but you must make some validations in the root var. For a functional example, go to :

http://www.santiagoscreams.com/tree/

PS: Sorry for my english.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜