Jump to content

Prevent auto expanding


d.bernaert

Recommended Posts

19 minutes ago, d.bernaert said:

I want to prevent the complete expansion of a unidbtreegrid when adding a subitem.

How could that be done?

I add a record to the dataset and just do a post.

Hello Dominique,

If possible, can you make a simple testcase for reproduce?

Link to comment
Share on other sites

Hi,

I've created a small sample application.

It's not quite the same problem but it shows what I want.

In this case, there are subtitles in the second title and in the third title.

Click on the second title and add a subtitle to the second title.

You will see that the complete tree view will be collapsed.

I want the second title to remain expanded and the new subtitle selected.

I also don't want the third title to be expanded when adding a subtitle to the second title.

Thx,

Dominique

Testapp.thumb.gif.682af170a6b46c95e89b6af59f90a59b.gif

TestTreeview.zip

Link to comment
Share on other sites

On 10/10/2019 at 2:13 PM, d.bernaert said:

TestTreeview.zip

Hello Dominique,

Sorry for the late reply.

Can you try to use this approach?

UniDBTreeGrid -> ClientEvents ->

1. UniEvents -> function beforeInit:

function beforeInit(sender, config)
{
    sender.expandedNodes=[];
}

2. ExtEvents -> function store.beforeload:

function store.beforeload(store, operation, eOpts)
{
    var me=this.grid;
    me.expandedNodes=[]; 
    me.getRootNode().cascadeBy(function(node) {
        if (node.data.expanded) {
            me.expandedNodes.push(node.data.id)
        }
    });
}

3. ExtEvents -> function store.nodeappend:

function store.nodeappend(sender, node, index, eOpts)
{
    if (node && node.data && this.grid.expandedNodes && this.grid.expandedNodes.indexOf(node.data.id)!=-1) {
        if (node.parentNode && node.parentNode.data.expanded) { 
            node.expand()
        } else if (node.parentNode) {
            node.parentNode.expand()
        }                  
    };
}

 

Link to comment
Share on other sites

  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...