Quantcast
Channel: JavaScriptMVC Forum
Viewing all articles
Browse latest Browse all 3491

can.Observe.List behavior

$
0
0
Hello,

I need a little help with observable lists.  I was expecting that splicing or pushing an array of observes on to an existing observe.list would keep things contiguous but am seeing something different. For Example...

  1. // start with empty list...
  2. var list = new can.Observe.List([]);

  3. // later
  4. list.push([new can.Observe({ prop1: value1, prop2: value2 }), new can.Observe({ prop1: value1, prop2: value2 })]);
  5. // or this acts the same..
  6. list.push([{ prop1: value1, prop2: value2 }, { prop1: value1, prop2: value2 }]);
When I wrote this code, i expected to have one list of observes.  Instead, in my inspector i see that each push or splice adds a new list to the list, and I've ended up with a list of lists. Is this how things are intended to work with Observe.List?  Is there some obvious thing I've missed to get the behavior i expect?

Thanks for you input, and for a great product.
Dan H.

Viewing all articles
Browse latest Browse all 3491

Trending Articles