cancel
Showing results for 
Search instead for 
Did you mean: 

Databind from listitem to parent object

olav_rask2
Explorer
0 Kudos

Hi everyone,

Here is what i am facing:

I have an object like this:

{

     "status" : "open",

     "items" : [{"title" : "Item 1"}, {"title" : "Item 2"}, {"title" : "Item 3"}]

}

Now i want to show a list of the elements in the "Items" collection. Each list item will have a button that will trigger some logic that should only be available while "status" is "open".  So what i would like to do is hide the button when status changes to something else.

This is what i am having trouble with: How do i bind the enabled property on the list item to the "status" property on the parent element?

Any input / suggestion will be greatly appreciated!

Best regards,

Olav

Accepted Solutions (0)

Answers (1)

Answers (1)

saivellanki
Active Contributor
0 Kudos

Hi Olav,

You didn't mention which control are you using for template.

With a rough assumption, will this sample help? Plunker

Regards,

Sai.

olav_rask2
Explorer
0 Kudos

Hi Sai

Thank you for you answer. It's close but unfortunately does not solve my issue i think.

A little more details about my example:

The page is bound to the single object i describet above. On the page is a list that uses the "items" collection for its items property. Each element is there by bound to an individual object from the "items" collection.

Now what i want to do is have a button on each element that has its enable property bound to the same property "status" on the main object. It is a "global" status that controls if users can make changes. (of couse alternative solutions are also welcome )

Regard Olav