Iterating through an object is somthing like this right ?
for(var i = 0, i < boxs.length; i++) {
var box = boxs[0];
// Then call the variables like this ???
var w = box.top.width;
}
On 12 Okt., 19:24, Fábio M. Costa <[email protected]> wrote:
> yeah im not understanding the problem but you can still iterate an object
> using the for in loop.
> But yeah, lets wait for somebody with native english.
>
> --
> Fábio Miranda Costa
> Solucione Sistemas
> Engenheiro de interface
>
>
>
> On Mon, Oct 12, 2009 at 1:58 PM, websam <[email protected]> wrote:
>
> > Well, then boxs becomes an object instead of an array.
>
> > The idé was that i would do somthing like this in my class :
>
> > . . .
> > render: function() {
> > this.options.boxs.each(function(box) {
> > this.renderBox(box);
> > }, this);
> > },
>
> > renderBox: function(box, injectInto) {
> > . . .
> > $(box.id).setStyles({
> > 'width': box.width,
> > 'height': box.height
> > });
> > . . .
> > }
> > . . .
>
> > so i don't know if you misunderstood the question ?
>
> > On 12 Okt., 16:11, Fábio M. Costa <[email protected]> wrote:
> > > you could do something like:
>
> > > window.addEvent('domready', function(){
> > > var layout = new ND.Layout({
> > > elm: 'box-container',
> > > boxs: {
> > > 'top': {width: x, height: y},
> > > 'bottom': {width: x, height: y}
> > > ...
> > > }
> > > });
>
> > > });
>
> > > or am i understanding something wrong?
>
> > > Cheers,
>
> > > --
> > > Fábio Miranda Costa
> > > Solucione Sistemas
> > > Engenheiro de interface
>
> > > On Mon, Oct 12, 2009 at 7:16 AM, websam <[email protected]> wrote:
>
> > > > Hi there,
>
> > > > I just started developing a class for creating a layout and need some
> > > > input.
>
> > > > What i intend ending up with is to be able to create a layout with an
> > > > top, left, center, right and bottom div like this :
>
> > > > <div id="box-container">
> > > > <div id="box-top"></div>
> > > > <div id="box-left"></div>
> > > > <div id="box-center"></div>
> > > > <div id="box-right"></div>
> > > > <div id="bottom"></div>
> > > > </div>
>
> > > > To generate this i would like to be able to somthing like this :
>
> > > > window.addEvent('domready', function(){
> > > > var layout = new ND.Layout({
> > > > elm: 'box-container',
> > > > boxs: [
> > > > {position: 'top'},
> > > > {position: 'left'},
> > > > {position: 'center'},
> > > > {position: 'right'},
> > > > {position: 'bottom'}
> > > > ]
> > > > });
> > > > });
>
> > > > Now in my class i have this :
>
> > > > ND.Layout = new Class({
> > > > Implements: [Options, Events],
>
> > > > options:{
> > > > elm: '',
> > > > boxs: []
> > > > },
>
> > > > initialize: function(options){
> > > > this.setOptions(options)
> > > > ...more code...
> > > > }
>
> > > > ...more functions...
> > > > });
>
> > > > For each items in the boxs array i would end up with a few variables
> > > > like position, width, height, resizable ect. and now for my question
> > > > where should i define these ?
>
> > > > A. in the boxs array
> > > > B. in an external object
> > > > C. in another class
>
> > > > Or don't i need to define them at all ?- Skjul tekst i anførselstegn -
>
> > > - Vis tekst i anførselstegn -- Skjul tekst i anførselstegn -
>
> - Vis tekst i anførselstegn -