Skip to Content
author's profile photo Former Member
Former Member

Binding of different sub-elements from the model

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    Posted on Feb 20, 2014 at 12:27 AM

    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);

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 21, 2014 at 08:07 PM

    Hi Maksim,

    how to I bind the object to an table?

    Sorry, I dont't understand your code :-)

    Jens

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.