Results 1 to 3 of 3

Thread: How to use Model with hasMany in template

  1. #1
    Sencha User
    Join Date
    Mar 2012
    Posts
    15

    Default How to use Model with hasMany in template

    Hi

    I can't find an example how to use a model with "hasMany" and template. I would like to have a Page with a main post, for example an idea, and the "hasMany" contains all comments to this idea.

    How can i past the model to an panel with an tpl attribute an d display the idea at the top and then all comments?

    Thx for the help.

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,379
    Answers
    3997

    Default

    If the data is already loaded then you can hook into prepareData method on the list/dataview to mix in the association. Otherwise, the itemTpl won't be able to load the associated data.
    Mitchell Simoens @LikelyMitch

    Check out my GitHub:
    https://github.com/mitchellsimoens

    Posts are my own, not any current, past or future employer's.

  3. #3
    Sencha User
    Join Date
    Mar 2012
    Posts
    15

    Default

    Thx for the answer. It would be great to define a Tpl which also includes a prefix for associated datas.

    For the moment I stoped to use Templates and add the informations / controls in the painted method of the view.

    Chears

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •