1. #1
    Touch Premium Member
    Join Date
    Dec 2011
    Posts
    17
    Vote Rating
    0
    jbeich is on a distinguished road

      0  

    Default MVC view based on heirarchical object model

    MVC view based on heirarchical object model


    I'm building an mvc view that's backed by a heirarchical object model. It's basically a grid w/ some groupings. So I've got to take the heirarchical object model and shape it into tabular data which I'll build a store from. Where does the shaping code belong? the view?

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,652
    Vote Rating
    901
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    That's up to you. Personally I'd have the Store/Model map to the data I want.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Touch Premium Member
    Join Date
    Dec 2011
    Posts
    17
    Vote Rating
    0
    jbeich is on a distinguished road

      0  

    Default


    Right I've got to get the model/store to reflect the data I want in that grid (the view). That's what I said. Or did you mean something different by "map to the data I want"?

    My question is: where is the appropriate place to handle transforming data from a hierarchical object model into a tabular model appropriate for display in a grid?

    So let's say your service gives you back (I'll just use object literal here, admittedly not valid json) { a: "foo", b: [ "bar1", "bar2" ] } and you want that to look like [ { a: "foo", b: "bar1" }, {a: "foo", b: "bar2" } ], or some other translation, so you can use it to build a store. Where would you do that? You can't just point your store to the url that provides that original object, right? You need it to be in a row-like format.

Thread Participants: 1

Tags for this Thread