1. #1
    Sencha User
    Join Date
    Feb 2011
    Posts
    3
    Vote Rating
    0
    vokunya is on a distinguished road

      0  

    Default Unanswered: Representation file system tree in TreeGrid

    Unanswered: Representation file system tree in TreeGrid


    Hi,
    i have a webapp - REST web service
    there is a folder with content there, for example:
    /path_to_folder/folder
    -file1.xsd
    -file2.xsd
    -subfolder_1
    ------file1_1.xsd
    ------subfolder_2
    ------------subfolder_2_1
    ------------file_2_1_1
    ------file_2_1
    and so on

    and i need to represent that tree in TreeGrid in another gxt webapp.

    perhaps, i can do on my ress webapp something like
    Code:
    {
        //...
    
        final Collection<File> all = new ArrayList<File>();
        addFilesRecursively(new File("path_to_folder/folder"), all);
    
        //....
        //send Collection<File> all to gxt webapp
        //...
    }
    
    private static void addFilesRecursively(File file, Collection<File> all) {
        final File[] children = file.listFiles();
        if (children != null) {
            for (File child : children) {
                all.add(child);
                addFilesRecursively(child, all);
            }
        }
    }
    and i can't to invent an algorithm to represent
    Code:
    Collection<File> all
    in TreeGrid
    any ideas?
    or some another problem solution?

    thanks

  2. #2
    Sencha User
    Join Date
    Jul 2009
    Location
    Trabzon
    Posts
    99
    Vote Rating
    0
    harun is on a distinguished road

      0  

    Thumbs up


    Hi Vokunya,

    I think your problem is related Basic TreeGrid example. You must look over the sample codes carefully.

    http://www.sencha.com/examples/explorer.html#basictreegrid

    Especially examine the following lines:

    Code:
    • Folder model = TestData.getTreeModel();
    • TreeStore<ModelData> store = new TreeStore<ModelData>();
    • store.add(model.getChildren(), true);
    You also must look TestData and Folder classes which are coming with GXT source code.

    I hope you can solve your problem,
    Best Regards,
    Website: harunates.com
    Blog: blog.harunates.com
    Feel free to contact me harun@harunates.com

Thread Participants: 1