changing montage/ui/repetition for digit/ui/list

31 views
Skip to first unread message

Gabriel Chertok

unread,
Mar 18, 2014, 8:58:02 PM3/18/14
to mont...@googlegroups.com
Hi my name is Gabriel,

First of all this is my first question on this forum so please forgive me if I'm asking a stupid thing.

I have a reel that shows theatres and movies / plays. One part of my app is changing the theatre title every time a theatre gets selected in a list. This was super easy to do with montage/ui/repetition using the isSelectionEnabled property but when I switched to digit/ui/list the selection stopped working.

Any advice on how to solve this?

Thanks in advance!

Here is part of my code:

<script type="text/montage-serialization">
    {
        "owner": {
          "properties": {
            "element": { "#": "owner" }
          }
        },
       
        "theatres" : {
          "prototype": "montage/ui/repetition.reel", //This doesn't work if I put digit/ui/list.reel
          "properties" : {
            "element" : { "#" : "theatre-list" },
            "isSelectionEnabled" : true
          }
        },
       
        "theatre": {
            "prototype": "digit/ui/text.reel",
            "properties": {
                "element": { "#" : "theatre" }
            },
            "bindings": {
              "value": { "<-": "@theatres.objectAtCurrentIteration.name" }
            }
        },
       
        "theatreItem" : {
          "prototype": "digit/ui/list-item.reel",
          "properties": {
              "element": { "#" : "theatre-item" }
          }
        },
       
        "theatreTitle" : {
          "prototype" : "digit/ui/title.reel",
          "properties" : {
            "element" : { "#" : "theatre-title" }
          },
          "bindings" : {
            "value" : { "<-" : "@theatres.selection.0.name ?? 'Select a Theatre'" }
          }
        }
    }

François Frisch

unread,
Mar 18, 2014, 9:09:16 PM3/18/14
to Gabriel Chertok, mont...@googlegroups.com
Hi,

The reason is that List does not expose a `selection` property. The Repetition's selection is really only exposed as a convenience for simple demos and it is only mirroring the RangeController's `selection`.
You have two options:
1. Use your own RangeController and bind to `contentController` instead of binding directly to the `content`. Here is an example of dealing with selection, http://montagejs.github.io/mfiddle/#!/7651480

Hope this helps

François

--
You received this message because you are subscribed to the Google Groups "Montage JS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to montagejs+...@googlegroups.com.
Visit this group at http://groups.google.com/group/montagejs.
For more options, visit https://groups.google.com/d/optout.

Gabriel Chertok

unread,
Mar 18, 2014, 10:00:55 PM3/18/14
to mont...@googlegroups.com, Gabriel Chertok
Hi François,

Thanks for the super fast answer! I think I got it now.

Gabriel
Reply all
Reply to author
Forward
0 new messages