Table Of Contents

Previous topic

JSUnit Widget

Next topic

ExtJS ItemSelector Widget Tutorial

ExtJS Tree Widget Tutorial


easy_install tw.extjs


Widget definition:

from tw.extjs import TreeView
extTree = TreeView(divID='treeView1', fetch='fetchTree')

Server Side

def ext(self):
    pylons.c.tree = extTree
    return dict()

Template Code


Fetch Code

import simplejson
def _getData(self, node):
    #return a list of dictionaries
    #dictionaries have the format:
    # {'text':visible_node_name, 'id':identifier, 'cls':'file'|'folder', 'allowChildren':False, 'leaf':True}
    #return the data for a given node
    #more here soon

def fetchTree(self, node):
    r = [self._getData(node),]
    return simplejson.dumps(r)


Difficulty: Medium. This entire tutorial is code snippets. Add some text to explain what is going on