Grouping sample

And here it is in GoJS:

Can you post the GoJS code?

Caution: I don’t know if the following code works in the current alpha release.
Furthermore there’s a bug trying to use GridLayout as the Group.layout, so it’s using the default Group layout.
[code]<!doctype html>

Partition GoJS Sample
[/code]

I tried this with the go.js (0.4.1) and received an error:
Microsoft JScript runtime error: Unable to get value of the property ‘constructor’: object is null or undefined

I’m using IE9 for dev right now.

When I run in Firefox, I get this error:
Error: d is undefined
Source File: http://localhost:1413/Scripts/GoJS/go.0.4.1.js
Line: 683

I just built and uploaded 0.4.2. Try it.
(BTW, this has a bug fix for setting Group.layout.)

Using 0.4.2 under IE9:
Microsoft JScript runtime error: Unable to get value of the property ‘constructor’: object is null or undefined

Line:
P.make=Yi=function(a,b){var c=m,d=m;if(typeof a===“function”)d=a;else if(typeof a===“string”){var e=aj[a];e!==f?c=e():d=da[a]}if(c===m){(d===m||!d.constructor)&&v.k("GraphObject.make requires a class function or class name, not: "+a);c=new d}e=1;if(c instanceof R&&arguments.length>1){d=arguments[1];if(typeof d===“string”||d instanceof HTMLDivElement){c.bm=m;jh(c,d);e++}else v.k("Unknown argument to Diagram constructor: "+d)}for(;e<arguments.length;e++){d=arguments[e];if(typeof d===“string”)c instanceof

{(d===m|| is highlighted.

Under Firefox:
Timestamp: 5/24/2012 4:32:46 PM
Error: d is undefined
Source File: http://localhost:1413/Scripts/GoJS/go.0.4.2.js
Line: 688

Note:

The diagram looks great!

:-)

Ah, sorry about that. I had a couple of typos in the sample.

It’s a common problem: forgetting to prefix “go.” in front of every GoJS type name.

This time I think I had written " Brush.randomColor() " instead of " go.Brush.randomColor() ".
I have updated the code above, so you can grab the whole page there.

OK, still seeing the errors in IE9 and Firefox 12.

Note: calling Diagram.zoomToFit() results in an error: Diagram.scale must be a real number and not NaN…

I just tested it again.
Are you sure you are using the new go.js and html page, not a cached version?

OK, I figured out why I am seeing the errors!!

I am using jQuery, which defines ‘$’ for all the jQuery stuff.

the goJS samples are also using the ‘$’. This was causing all kinds of issues.

I am calling jQuery.noConflict(); in my test code now, which allows me to use the sample unmodified.

But, jQuery is very popular and I’m sure that somebody else will run into this.

But the sample/page explicitly binds $, to avoid any conflict:

var $ = go.GraphObject.make;

So unless some other package is setting window.go, there cannot be any conflict with GoJS.

I’m not a Javascript expert yet.

What I can say is that I have jQuery loaded with the sample and it has an error with IE9/Firefox.

When I added jQuery.noConflict(); to my code, and change my jQuery $(blah) to jQuert(blah) the errors stopped.

Sorry that I can’t be more of a help.

I figured out what was failing in my sample. ECMAScript uses function scope, not block scope. My tired brain was reading the code with block scope in mind.

In any case, you were correct, the issue was mine.