cancel
Showing results for 
Search instead for 
Did you mean: 

Binding of different sub-elements from the model

Former Member
0 Kudos

Hi,

I have a question relating filtering/binding of different sub-trees to ONE table.

I have a model, where I store "activities" under each "customer"'s node, e.g

[CUSTOMER_4711]

  [ACTIVITIES-A]

  [ACTIVITIES-B]

  [ACTIVITIES-C]

[CUSTOMER_0815]

  [ACTIVITIES-D]

  [ACTIVITIES-E]

  [ACTIVITIES-F]

So each customer node got [0...n] activities.

When I navigate trough the model I can use my customer binding context to display all activities link to this customer.

Fine so far!

My challenge is now, that I want to create an other screen with an table, where I can see ALL activities of ALL customer.

My current approch is, to traverse the complete model and create a temporary model.

I wonder, if there is an other solution to adchive this 🙂

Cheers

Jens

Accepted Solutions (1)

Accepted Solutions (1)

former_member182372
Active Contributor
0 Kudos

my favorite 🙂

var JSONData = [{

    name: "CUSTOMER_4711",

    activites: [{

        name: "ACTIVITIES-a"

    }, {

        name: "ACTIVITIES-b"

    }, {

        name: "ACTIVITIES-c"

    }]

}, {

    name: "CUSTOMER_0815",

    activites: [{

        name: "ACTIVITIES-d"

    }, {

        name: "ACTIVITIES-e"

    }, {

        name: "ACTIVITIES-f"

    }]

}];

Object.defineProperty(JSONData, "AllActivites", {

    get: function () {

        return $.map(JSONData,

        function (val, i) {

            return val.activites;

        });

    }

});

console.log(JSONData.AllActivites);

Former Member
0 Kudos

Thanks.

I will try

Jens

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Maksim,

how to I bind the object to an table?

Sorry, I dont't understand your code 🙂

Jens

former_member182372
Active Contributor
0 Kudos

Same way as usuall - {AllActivites}