Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Is it possible to limit how deep the tree can go?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
boteeka  
View profile  
 More options Apr 8 2009, 10:02 am
From: boteeka <bote...@gmail.com>
Date: Wed, 8 Apr 2009 07:02:43 -0700 (PDT)
Local: Wed, Apr 8 2009 10:02 am
Subject: Is it possible to limit how deep the tree can go?
I have a tree with folder nodes only on it. These nodes can be dragged
and dropped on each other. I want to limit the tree to be only two
levels deep, and so any drag-and-drop attempts which would make the
tree more deep would be disallowed. Is there a method to accomplish
this with the current featureset of jsTree 0.9.6?

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
vakata  
View profile  
 More options Apr 8 2009, 11:16 am
From: vakata <ivan.bozha...@gmail.com>
Date: Wed, 8 Apr 2009 08:16:57 -0700 (PDT)
Local: Wed, Apr 8 2009 11:16 am
Subject: Re: Is it possible to limit how deep the tree can go?
Yes, check the metadata (under "others" on the examples page) examples
- what you are looking for is "max_depth".

Best regards,
Ivan

On 8 Апр, 17:02, boteeka <bote...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
boteeka  
View profile  
 More options Apr 9 2009, 3:44 am
From: boteeka <bote...@gmail.com>
Date: Thu, 9 Apr 2009 00:44:20 -0700 (PDT)
Local: Thurs, Apr 9 2009 3:44 am
Subject: Re: Is it possible to limit how deep the tree can go?
Ok, that was dumb on my part not to look first. Sorry.

However, I looked on the examples. The difference is that I'm using
async JSON as source, and it doesn't seem to work. Here it is the JSON
response for the top level objects:
([
        {
                attributes: {id: 1},
                state: 'closed',
                data: 'Electronics',
                mdata: { type: 'file', max_depth : 2 }
        },
        {
                attributes: {id: 6},
                state: 'closed',
                data: 'Portable electronics',
                mdata: { type: 'folder', max_depth : 2 }
        }
])

In the rules attribute of the configuration I set metadata: "mdata".
Oh, and the metadata jquery plugin is loaded.

The problem is that it doesn't work at all. Even if I change the type
to file it doesn't show any difference.
Most probably I made some mistakes on the metadata part, but can't
figure it out what exactly.

On Apr 8, 6:16 pm, vakata <ivan.bozha...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
vakata  
View profile  
 More options Apr 9 2009, 1:46 pm
From: vakata <ivan.bozha...@gmail.com>
Date: Thu, 9 Apr 2009 10:46:52 -0700 (PDT)
Local: Thurs, Apr 9 2009 1:46 pm
Subject: Re: Is it possible to limit how deep the tree can go?
Hi,
I am sorry the metadata example was not available when I posted my
previous reply - you can take a look at it now:
http://www.jstree.com/reference/_examples/5_others.html (the second
example).

Basically you need this type of structure:
...
        {
                attributes: {id: 1, mdata : "{ type: 'file',
max_depth : 2 }" },
                state: 'closed',
                data: 'Electronics'
        },
...

mdata becomes part of the attributes and its value is a string.

I hope this helps!
Best regards,
Ivan

On 9 Апр, 10:44, boteeka <bote...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Szász Botond  
View profile  
 More options Apr 16 2009, 2:03 am
From: Szász Botond <bote...@gmail.com>
Date: Thu, 16 Apr 2009 09:03:54 +0300
Local: Thurs, Apr 16 2009 2:03 am
Subject: Re: [jsTree:548] Re: Is it possible to limit how deep the tree can go?

Hi,

Thanks for your guidance. I finally worked out. But I found that your
example does not work:
...
       {
               attributes: {id: 1, mdata : "{ type: 'file',  max_depth : 2

}" },

               state: 'closed',
               data: 'Electronics'
       },
...

This example produces tree items like this:

<li class="closed last" id="4" }="" folder="" mdata="{ type : "><a class=""
style="" href="#">LCD</a></li>

In order for this to work, the syntax for mdata needs to be like this:
mdata: '{ type: "folder", max_depth : 1 }'

The difference is the quotes used. Your example also gave a syntax error in
jquery.metadata plugin.

I just thought it might be useful to know.

Thank you once again for your help and the great work you put in jsTree!
Greatly appreciated.

2009/4/9 vakata <ivan.bozha...@gmail.com>

--
Szász Botond
   e-mail: bote...@gmail.com,
              bote...@yahoo.com
   tel.: +40744303363

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »