storkCore

Artifact [d0217442e4]
Login

Artifact [d0217442e4]

Artifact d0217442e49978c29a08e7cac39f2c05953f94ca:


<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html> <head>
<title></title>
        <script type="text/javascript" src="../storkCore.js">
            </script>
        <script type="text/javascript" src="../list.js">
            </script>

</head>

<body>
<h1></h1>

<p>
The following lists should have different content. Two models are
created, one cloned from the other, with a list model within that is
used for the content. Normally that would lead to them having the same
content, but the list model ("items") is specified to be a
clonedProperty of the containing model, which means the two models do
not point to the same list model.
<h2>First List</h2>
<ul id="list1">  <!-- Container element -->
  <!-- Actual list items will be copied into here -->
</ul>


<h2>Second List</h2>
<ul id="list2">  <!-- Container element -->
  <!-- Actual list items will be copied into here -->
</ul>


<div style="display: none;">
  <ul>
    <!-- 'Template' for each item in the list -->
    <li id="item_#n"><span id="text_#n"></span></li>
  </ul>
</div>        


<hr>
<address></address>
<!-- hhmts start -->Last modified: Tue Feb  6 13:15:47 EET 2018 <!-- hhmts end -->
</body>
<script type="text/javascript">
var firstList = clone(ListController);
firstList.setListContainer(elementByID("list1"));

var listItem = clone(ListItemController);
listItem.setItemTemplate(elementByID("item_#n"));
listItem.linkTextProperty("text", "text");
firstList.setItemControllerPrototype(listItem);

var firstModel = clone(StorkModel);
firstModel.setProperty("items", clone(ListModel));
firstModel.clonedProperty("items", ListModel);

var secondModel = clone(firstModel);

firstItems = firstModel.getProperty("items");
firstItems.pushObject({text: "Foo"});
firstItems.pushObject({text: "Bar"});

var secondList = clone(ListController);
secondList.setListContainer(elementByID("list2"));
secondList.setItemControllerPrototype(listItem);

secondItems = secondModel.getProperty("items");
secondItems.pushObject({text: "Goo"});
secondItems.pushObject({text: "Gah"});

firstList.setModel(firstModel.getProperty("items"));
secondList.setModel(secondModel.getProperty("items"));

        </script>


        </html>