Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6353361
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:23:53+00:00 2026-05-24T22:23:53+00:00

I can’t understand that part, neither trying the showcase examples. I’m using an extension

  • 0

I can’t understand that part, neither trying the showcase examples.

I’m using an extension of AsyncDataProvider to bind my tree to RPC service. Here’s my method:

public <T> NodeInfo<?> getNodeInfo(T value) {
        /*
        if (value instanceof Categoria) {
            dataProvider.setCurrentParent((Categoria)value);
        }
        */
        return new DefaultNodeInfo<Categoria>(dataProvider, new CategoriaCell());
    }

“currentParent” is my stuff: except for (null => root) values, I set the parent to pass via RPC to my service. Actually, in my widget code:

dataProvider = new CategorieTreeDataProvider() {            
            @Override
            protected void onRangeChanged(HasData<Categoria> display) {
                updateTree(getCurrentParent());
            }
        };

private void updateTree(Categoria categoria) {
        rpcService.getCategorie(categoria, new AsyncCallback<Categoria[]>() {
            @Override
            public void onSuccess(Categoria[] result) {
                dataProvider.updateRowCount(result.length, true);
                dataProvider.updateRowData(0, Arrays.asList(result));
            }
            @Override
            public void onFailure(Throwable caught) {
                Window.alert(caught.toString());
            }
        });
    }

My rpc-server code, however, is working as expected:

@Override
    public Categoria[] getCategorie(Categoria parent) {
        List<Categoria> categoryList = categorieDao.listByProperty("parent", parent);
        for (Categoria c : categoryList) {
            if (categorieDao.listByProperty("parent", c).size() == 0) {
                c.setLeaf(true);
            }
        }
        return categoryList.toArray(new Categoria[0]);
    }

**Then I add some data to my Categories: ‘GrandFather’, ‘Father’ and ‘Son’.

Unfortunately, after loading my widget, I see:

  • The grandfather correctly, with his “+” how expected;

  • Then I click it and…

  • The grandfather disappear and I see ‘Father’ with his ‘+’

  • same for father -> son

I suspect the bug is in updateRowCount / updateRowData usage.**

Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T22:23:55+00:00Added an answer on May 24, 2026 at 10:23 pm

    The getNodeInfo is called whenever you open a node so you have to create distinct DataProvider for each of the nodes’s childs.

    public <T> NodeInfo<?> getNodeInfo(T value) {
            if (value == null) {
                return new DefaultNodeInfo<Category>(dataProvider, new CategoriaCell());
            }
            else if (value instanceof Categoria) {
                     Category category  = (Category)value;
                 return new DefaultNodeInfo<Grandfather>(new ListDataProvider<Grandfather>(category.getGrandFathers()),new GrandFatherCell());
            }
            else if (value instanceof Grandfather) {
                 Grandfather grandfather = (Grandfather)value;
                 return new DefaultNodeInfo<Father>(new ListDataProvider<Father>(granfather.getFathers()),new FatherCell());
            }
            else if (value instanceof Father) {
                //same as above but with fathers.
            }
        }
    

    The category.getGrandFathers() function can for example do a RPC request to the server or just return the list if you retrieve everything in one RPC request.

    UPDATE based on comment:

    So in case you have only one class and want to achieve a dynamic CellTree (number of levels are not pre-determined) you could take following approach.

    public <T> NodeInfo<?> getNodeInfo(T value) {
        if (value == null) {
            return new DefaultNodeInfo<Category>(dataProvider, new CategoriaCell());
        }
        else {
            Category category  = (Category)value;
            return new DefaultNodeInfo<Category>(new ListDataProvider<Category>(category.getSubCategories()),new CategoryCell());
        }
    }
    

    category.getSubCategories() is either an RPC call which retrieves the subcategories for the current category or if the Category class is a linked list type datastructure it could just return the list of subcategories.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can PHP PDO extension bind nested objects automatically ? I mean using foreign key
Can somebody point me to a resource that explains how to go about having
Can a LINQ enabled app run on a machine that only has the .NET
I am trying to understand how to use SyndicationItem to display feed which is
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
Can I call select before recv_from on a socket that is blocking?
Can I have a project that has some parts written in c and other
Can some one confirm me that only one UIWindow instance is possible in any
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.