Adding items to list stopped working


On Saturday this code worked just fine:

for (var i = 0; i < 25; i++) {
    dataFromSpekter.add( {name: "Programpost " + post++, type: "Programtype" + Math.floor(Math.random()  5 + 1), date:                Math.floor(Math.random()  4)} );

But on Sunday it just added null to the list. I have checked the output in debug_log and searched the forums, but not found any answers.

This shows me that the items get created, but that an error occures when adding it to my list:

for (var i = 0; i < 25; i++) {
  var item = ({name: "Programpost " + post++, type: "Programtype" + i, date: i});
  debug_log(;  dataFromSpekter.add(item);

This is extremly confusing! Any idea why?


It is hard to tell what’s going on from just these islolated lines. Can you please provide a full test case? Thanks.

If the list is an observable then I don’t think you can use array syntax to access its entries (in the last debug_log).

How did you verify that everything was working on Saturday?

SHOOT! Very sorry you guys, found the issue.

I did a refactoring where i moved this:

 <Panel ux:Class="InfoView" ux:AutoBind="false">
         <Move X="1" RelativeTo="ParentSize" />
         <Move X="-1" RelativeTo="ParentSize" />
       <Text>Welcome to page 2!</Text>
       <Button Text="Go Back" Clicked="{navigateToProgramPage}"/>

into a file called InfoView.ux and used it in the same place in the code like this:

<InfoView ux:Name="infoPage" Background="#555"/>

But then, since it was placed above my tabbedPage in the MainView.ux file, it placed it self on the top instead. So now i learned that when I move a page to its own file, remove the surrounding <Panel> -tag

Thanks for “making” me create a demo-project :wink:

Great that it worked out! :slight_smile: