[Dojo-interest] Help: dijit.Tree

Daniel daniel.carrera at zmsl.com
Mon Dec 10 16:43:26 UTC 2007


Yes, I read that page. I listed it in my first email.

Daniel.

Jon Sykes wrote:
> http://www.dojotoolkit.org/book/dojo-book-0-9/part-3-programmatic-dijit-and-dojo/manipulating-widgets-through-code/displaying-w
> 
>> Thus, the programmatic equivalent of:
>>
>> <div dojoType="dijit.TitlePane" title="Inner Pane">
>>   And this is the inner title pane...
>> </div>
>>
>> from the example above would be:
>>
>> var innerPane = new dijit.TitlePane( {title:"Inner Pane"},  
>> dojo.byId("someDiv"));
>>
>> When that line executes, the div with the id "someDiv" will be  
>> replaced with a TitlePane widget, with title "Inner Pane".
> 
> 
> 
> 
> On Dec 10, 2007, at 11:17 AM, Jon Sykes wrote:
> 
>> Groups is already a title pane.
>>
>>> <div dojoType="dijit.TitlePane" title="Groups" id='Groups'></div>
>> Then you try and make it into a tree.
>>
>>> var tree = new dijit.Tree({
>>> 			store:store,
>>> 			labelAttr:'name',
>>> 			typeAttr:'type',
>>> 			query:{ type: "category" }
>>> 		}, dojo.byId("Groups")
>>> 	);
>>
>> That's probably the issue.
>>
>> On Dec 10, 2007, at 11:13 AM, Daniel wrote:
>>
>>> Tom Trenka wrote:
>>>> Try this.
>>> Thanks. That clearly did "something". I get an entirely different
>>> error
>>> now. Here is my code:
>>>
>>> dojo.require("dojo.parser");
>>> dojo.require("dijit.Tree");
>>> dojo.require("dijit.TitlePane");
>>> dojo.require("dijit.layout.ContentPane");
>>> dojo.require("dijit.layout.SplitContainer");
>>> dojo.require("dojo.data.ItemFileReadStore");
>>> ...
>>> <div dojoType="dijit.TitlePane" title="Groups" id='Groups'></div>
>>> ...
>>> dojo.addOnLoad(function() {
>>> 	var data = { label: 'name',
>>> 		identifier: 'name',
>>> 		items: [
>>> 			{ name:'Fruit', type:'category'},
>>> 			{ name:'Cinammon', type: 'category'},
>>> 			{ name:'Chocolate', type: 'category'}
>>> 		]
>>> 	}
>>> 	var store = new dojo.data.ItemFileReadStore(data);
>>> 	var tree = new dijit.Tree({
>>> 			store:store,
>>> 			labelAttr:'name',
>>> 			typeAttr:'type',
>>> 			query:{ type: "category" }
>>> 		}, dojo.byId("Groups")
>>> 	);
>>> });
>>>
>>>
>>> And this is the error I got this time:
>>>
>>> [Exception... "'Error: Tried to register widget with id==Groups but
>>> that
>>> id is already registered' when calling method:
>>> [nsIDOMEventListener::handleEvent]" nsresult: "0x8057001c
>>> (NS_ERROR_XPC_JS_THREW_JS_OBJECT)" location: "<unknown>" data: no]
>>>
>>>
>>> I swear I haven't done anything with 'Groups' other than what you see
>>> here. It's inside a splitContainer but that's all.
>>>
>>>
>>>> The key is to make sure you are passing an object with the same
>>>> properties
>>>> that you'd normally have to have when you are creating via markup,
>>>> namely
>>>> the store reference and the query.
>>> Ok. So, by looking at the markup I can often guess what the program
>>> call
>>> looks like? I thought that, but notice that in this particular  
>>> example
>>> the markup doesn't help:
>>>
>>> <div dojoType="dojo.data.ItemFileReadStore"
>>>     url="poptarts.txt" jsid="popStore"/>
>>> <div dojoType="dijit.Tree" store="popStore" labelAttr="name"
>>>     label="Pop Tarts"></div>
>>>
>>>
>>> Best,
>>> Daniel.
>>> _______________________________________________
>>> FAQ: http://dojotoolkit.org/support/faq
>>> Book: http://dojotoolkit.org/docs/book
>>> Forums: http://dojotoolkit.org/forum
>>> Dojo-interest at dojotoolkit.org
>>> http://dojotoolkit.org/mailman/listinfo/dojo-interest
>> _______________________________________________
>> FAQ: http://dojotoolkit.org/support/faq
>> Book: http://dojotoolkit.org/docs/book
>> Forums: http://dojotoolkit.org/forum
>> Dojo-interest at dojotoolkit.org
>> http://dojotoolkit.org/mailman/listinfo/dojo-interest
> 
> _______________________________________________
> FAQ: http://dojotoolkit.org/support/faq
> Book: http://dojotoolkit.org/docs/book
> Forums: http://dojotoolkit.org/forum
> Dojo-interest at dojotoolkit.org
> http://dojotoolkit.org/mailman/listinfo/dojo-interest
> 



More information about the Dojo-interest mailing list