OpenLaszlo Prototype - Task Grid - Much Love
My last report of creating my task grid in OpenLaszlo (for my web-based, Project Management application, Ataraxis Unity) had tales of my struggle with the standard issue "grid" and "tree" components.
Nay! I will not be stopped! :)
I chose to start programming my own component from scratch, and I've done the happy dance several times tonight.
I just needed one part datapointer (OpenLaszlo class) understanding, one part recursion, and one part knowing how to dynamically add "views" (OpenLaszlo class) to another view.
My first attempt at adding a view to another in JavaScript was a little backward. (OpenLaszlo uses JavaScript as it's scripting language. Don't confuse this with the JavaScript that runs in your browser.)
Here is what didn't work:
I thought this would work because there is a method on the "view" class called, "addSubview(view)". Through some testing I found that it was in fact adding them to the view, but a) it wasn't rendering the views properly b) wasn't adding the sub views to the container's "subviews" array c) just isn't the way you're supposed to dynamically add views through JavaScript!
I completely missed the fact that the view class has the following constructor: "constructor(parent, args)". Which translates to, "pass me my parent view and my attribute list".
Here is what works:
The more I work with OpenLaszlo the more I like it. At first I loved it, then I got extremely frustrated by it, and now I'm loving it again. :)
Nay! I will not be stopped! :)
I chose to start programming my own component from scratch, and I've done the happy dance several times tonight.
I just needed one part datapointer (OpenLaszlo class) understanding, one part recursion, and one part knowing how to dynamically add "views" (OpenLaszlo class) to another view.
My first attempt at adding a view to another in JavaScript was a little backward. (OpenLaszlo uses JavaScript as it's scripting language. Don't confuse this with the JavaScript that runs in your browser.)
Here is what didn't work:
- Create "container" view.
- Create a "contained" view.
- Add the "contained" view to the "container". (container.addSubview(contained))
- Loop back up to #2 until I ran out of of views to be contained.
I thought this would work because there is a method on the "view" class called, "addSubview(view)". Through some testing I found that it was in fact adding them to the view, but a) it wasn't rendering the views properly b) wasn't adding the sub views to the container's "subviews" array c) just isn't the way you're supposed to dynamically add views through JavaScript!
I completely missed the fact that the view class has the following constructor: "constructor(parent, args)". Which translates to, "pass me my parent view and my attribute list".
Here is what works:
- Create "container" view.
- Create "contained" view, passing in the container view as it's parent.
- Repeat #2 until you run out of views to be contained.
The more I work with OpenLaszlo the more I like it. At first I loved it, then I got extremely frustrated by it, and now I'm loving it again. :)


0 Comments:
<< Home