[ 6 posts ]

Nate DAmico

  • Username: kaiyzen
  • Joined: Fri Nov 27, 2009 3:44 pm
  • Posts: 40
  • Offline
  • Profile
Tags:

Having trouble with config running treeview locally

Post Posted: Tue Dec 28, 2010 7:20 pm
+0-
I am starting to work with 3.3pr2 to take advantage of some of the latest and greatest. First time I have tried to include a gallery module and run from local, having some issues. Navigating the proper config examples that are in other posts has been quite hairy so far.

I noticed the post where it was mentioned to refer to the examples on github until the CDN was updated for proper config/inclusion, in looking at the object example I started with the following:

YUI({
modules: {
"gallery-yui3treeview": {
fullpath : "../../../../yui3-gallery/build/gallery-yui3treeview/gallery-yui3treeview.js",
requires : ["substitute", "widget", "widget-parent", "widget-child","node-focusmanager"]
} },
filter:"raw",
combine : false
})

From other posts from people trying to get gallery and YUI2 widgets/modules running locally they have a gallery group defined. Here I see the use of the modules attribute.

In trying both, the groups one seems to be ignored for trying to set a local base uri, but setting base under the modules.galler-yui3treeview worked to get proper base.

The path came out to <my base>/gallery-yui3treeview/gallery-yui3treeview-min.js

Just to test to see if things were working I took the TreeView.js file contents from github and created the -min.js file. I am still getting the following errors:

Y is not defined
[Break On This Error] var getClassName = Y.ClassNameManager.getClassName,
galler...-min.js (line 1)

Y.TreeView is not a constructor
[Break On This Error] label : "level1-2"


Is my config causing all the issues here, or is it also something to do with my general usage of the treeview mod?

Gonzalo Cordero

YUI Developer

  • Username: gonzalocordero
  • Joined: Fri Jul 31, 2009 2:23 pm
  • Posts: 16
  • Location: Y! Front End engineer
  • Twitter: goonieiam
  • GitHub: goonieiam
  • Gists: goonieiam
  • YUI Developer
  • Offline
  • Profile

Re: Having trouble with config running treeview locally

Post Posted: Mon Jan 10, 2011 6:07 pm
+0-
Nate:

I'm guessing that some of the assets are not being loaded, and that's why you're getting those errors. I guess I should change the examples in the example folder to use the actual CDN build, rather than the build version on the repo.

Change your YUI use statement to this:

YUI({
//Last Gallery Build of this module
gallery: 'gallery-2011.01.03-18-30'
}).use('gallery-yui3treeview', function(Y) {

var treeview = new Y.TreeView({
srcNode: '#mytree',
contentBox: null,
type: "TreeView",
children: [
{
label: "level1-1",
type: "TreeView",
children: [
{label: "level2-1"},
{label: "level2-2"}
]
},
{
type: "TreeView",
label : "level1-2"
}
]
});
treeview.render();
});


That's the proper way to actually load treeview.

Thanks!!

Nate DAmico

  • Username: kaiyzen
  • Joined: Fri Nov 27, 2009 3:44 pm
  • Posts: 40
  • Offline
  • Profile
Tags:

Re: Having trouble with config running treeview locally

Post Posted: Fri Jan 14, 2011 12:50 am
+0-
Thanks for the reply Gonzalo,

Gave your snippet a test run, I get this erron on my end now in firebug:


TypeError: this.groups.gallery.update is not a function
this.groups.gallery.update(val);


It happens on line 792 in loader.js

Seems like the snippet you gave me is meant to pull from the CDN, correct?

I have to run all of my base and gallery files locally from the same server the app is getting served from

Gonzalo Cordero

YUI Developer

  • Username: gonzalocordero
  • Joined: Fri Jul 31, 2009 2:23 pm
  • Posts: 16
  • Location: Y! Front End engineer
  • Twitter: goonieiam
  • GitHub: goonieiam
  • Gists: goonieiam
  • YUI Developer
  • Offline
  • Profile

Re: Having trouble with config running treeview locally

Post Posted: Thu Jan 20, 2011 12:00 pm
+0-
Nate:

I posted an example here:

http://goonieiam.com/treeview/treefromobject.html


It's using the gallery conf object. So take a look and let me know if that helps

thanks!

Nate DAmico

  • Username: kaiyzen
  • Joined: Fri Nov 27, 2009 3:44 pm
  • Posts: 40
  • Offline
  • Profile

Re: Having trouble with config running treeview locally

Post Posted: Thu Jan 20, 2011 2:44 pm
+0-
Hey Gonzalo,

Your example helps from a general usage standpoint. The issue I am running into is serving the treeview gallery module from my local server, not from the CDN, the app I am building requires this.

In your example you are pulling YUI base and the gallery from the CDN, and things work fine that way. The error in my initial post is what I get when I downloaded the gallery treeview file to my server and changes the YUI Config to pull that file:

------------------------------------
Y is not defined
var getClassName = Y.ClassNameManager.getClassName,galler...-min.js (line 1)

Y.TreeView is not a constructor
label : "level1-2"
-----------------------------------

In looking at the file contents for treeview, looks like the Y instance is just hanging out in the open, so when its included Y hasnt been defined in the files contents. Dont know if the CDN pulls do something to wrap during combo stage

So to generalize the issue, if you wanted to run your http://goonieiam.com/treeview/treefromobject.html example from your local machine, serving all the YUI base/gallery js files to make the treeview work, what would the config and setup look like?

paolo nesti poggi

YUI Contributor

  • Username: paolo
  • Joined: Sat Mar 14, 2009 9:53 am
  • Posts: 77
  • Location: Roskilde DK
  • GitHub: tribis
  • Gists: tribis
  • Offline
  • Profile
Tags:

Re: Having trouble with config running treeview locally

Post Posted: Fri Mar 18, 2011 3:02 am
+0-
The post is old, however it might help somebody else. So here is what i do:
Code:
YUI({
   filter:"debug",/* min|raw */
   
    modules:{
       'gallery-yui3treeview':{
          fullpath: '/yui3-gallery/build/gallery-yui3treeview/gallery-yui3treeview-min.js',
          requires:["substitute","widget","widget-parent","widget-child","node-focusmanager"],
            optional: [],
            supersedes: []
       }
    }   

}).use('gallery-yui3treeview', function(Y) {
   
   var treeview = new Y.TreeView({ 
        srcNode: '#mytree',
        contentBox: null,
        type: "TreeView",
        children: [
                      {
                         label: "level1-1",
                         type: "TreeView",
                         children: [
                             {label: "level2-1", id:"123"},
                             {label: "level2-2", id:"456"}
                         ]
                      },
                      {
                          type: "TreeView",
                         label : "level1-2"
                     }
                  ]
   });
   
   treeview.render();

});


/paolo
  [ 6 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum