Ajax treeview

9 views
Skip to first unread message

Noorhan Abbas

unread,
Aug 3, 2008, 5:16:34 PM8/3/08
to Google Appengine
Hello,
I need to use an ajax tree view in google appengine. Does anyone has any experience in that specially Yahoo User Interface tree view?
The main thing is the ajax tree view whatever the provider is...
 
Thank you very much,
Nora


Not happy with your email address?
Get the one you really want - millions of new email addresses available now at Yahoo!

code@brilaps

unread,
Aug 4, 2008, 4:58:53 AM8/4/08
to Google App Engine

Hi Nora,

YUI treeview does the trick pretty good. Here is a sample code for you
to play with
-----------

var tree; //will hold the TreeView instance
var callbacks = {
//gotta love recursion :)
drawCategoryTree : function (msgs, node) {

for (var i = 0; i < msgs.length; i++) {
var m = msgs[i];
if (!is_array(m)) {
var tmpNode = new
YAHOO.widget.MenuNode(m.category_name, node, false);
tmpNode.data = m;
tmpNode.onLabelClick = clickHandler;
}
else {
this.drawCategoryTree(m, tmpNode);
}
}
},

// successfull XHR response handler
success : function (o) {
var messages = [];

// Use the JSON Utility to parse the data returned from
the server
try {
messages = YAHOO.lang.JSON.parse(o.responseText);
// The returned data was parsed into an array of objects.
tree = new YAHOO.widget.TreeView("category-tree");

if (messages.length > 0) {
this.drawCategoryTree(messages,
tree.getRoot());
}

tree.draw();
//@TODO tree.expandAll();
}
catch (e) {
alert("JSON Parse failed!" + e);
}
},
failure : function (o) {
if (!YAHOO.util.Connect.isCallInProgress(o)) {
alert("Async call failed!");
}
},
timeout : 3000
};

// Make the call to the server for JSON data
YAHOO.util.Connect.asyncRequest('GET','/
someactionthatreturnsajsonresponse/', callbacks);
}


Hope this helps
Cem

On Aug 3, 2:16 pm, Noorhan Abbas <noorhanab...@yahoo.co.uk> wrote:
> Hello,
> I need to use an ajax tree view in google appengine. Does anyone has any experience in that specially Yahoo User Interface tree view?
> The main thing is the ajax tree view whatever the provider is...
> Thank you very much,
> Nora
>
>       __________________________________________________________
> Not happy with your email address?.
> Get the one you really want - millions of new email addresses available now at Yahoo!http://uk.docs.yahoo.com/ymail/new.html
Reply all
Reply to author
Forward
Message has been deleted
0 new messages