Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8001087
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T15:59:50+00:00 2026-06-04T15:59:50+00:00

I hardly even know how to ask this one, but here goes. I have

  • 0

I hardly even know how to ask this one, but here goes.

I have two models, a Platter which contains many Recipes:

Ext.define('NC.model.Platter', {
  extend: 'Ext.data.Model',
  config: {
    fields: [
      { name: 'name', type: 'string' },
      { name: 'text', type: 'string' }
    ],
    associations: [
      {type: 'hasMany', model: 'NC.model.Recipe', name: 'recipes', filterProperty: 'text'}
    ]
  }
});

Ext.define('NC.model.Recipe', {
  extend: 'Ext.data.Model',
  config: {
      fields: [
        { name: 'name', type: 'string' },
        { name: 'image', type: 'string' },
        { name: 'stepsText', type: 'string', mapping: 'properties.preparationText' },
        { name: 'ingredientsText', type: 'string', mapping: 'properties.ingredientsText' }
      ]
    }
});

Platters are basically different filters on an online recipe store. So I might have a thousand recipes but my ‘Pizza’ platter will only return pizza recipes (thus the filterProperty). Platters are just created and stored locally, whereas Recipes are online. So, the stores:

Ext.define('NC.store.Platters', {
  extend: 'Ext.data.Store',

  config: {
    model: 'NC.model.Platter',
    storeId: 'Platters',
    proxy: {
      type: 'localstorage',
      id: 'platters'
    },
    data : [
        {name: 'Noodles', text: 'noodle'},
        {name: 'Baked', text: 'bake'},
        {name: 'Pizza', text: 'pizza'}
    ]
  }
});

Ext.define('NC.store.Recipes', {
  extend: 'Ext.data.Store',

  config: {
    model: 'NC.model.Recipe',
    storeId: 'Recipes',
    proxy: {
      type: 'jsonp',
      url: 'xxxx',  // url here (redacted)
      callbackKey: 'callback',
      filterParam: 'text',
      extraParams: {
        // credentials and tokens here (redacted)
      },
      reader: {
        type: 'json',
        idProperty: 'uuid',
      }
    }
  }
});

Now, I would like to create a dataview of dataviews. A list of Platters, each containing it’s list of Recipes:

Ext.define('NC.view.DiscoverGrid', {
  extend: 'Ext.DataView',
  xtype: 'discovergrid',
  id: 'discover',

config: {
    title: 'Discover',
    baseCls: '',
    useComponents: true,
    defaultType: 'platter',
    store: 'Platters',
    ui: 'light'
  }
});

Ext.define('NC.view.Platter', {
  extend: 'Ext.dataview.component.DataItem',
    xtype: 'platter',

  config: {
      layout: 'fit',
      height: '100px',
      list: {
        itemTpl: '{name}',
        inline: true,
        scrollable: {
          direction: 'horizontal',
          directionLock: true
        }
      },
      dataMap: {
        getList: {
          setData: 'recipes'
        }
      }
    },

    applyList: function(config) {
      return Ext.factory(config, Ext.DataView, this.getList());
    },

  updateList: function(newList, oldList) {
    if (newList) {
        this.add(newList);
      }

  if (oldList) {
        this.remove(oldList);
      }
    }
  });

Now, how do I populate the platter’s recipes? If I populate the Platters with a little in-line recipe data like, so:

data : [
    {name: 'Noodles', text: 'noodle', recipes: [
      { name: 'Pasta', ingredientsText: "Tomatoes\nPassata\n1tsp Oregano", preparationText: "Do something\nAdd passata\nmix in oregano and tomato",
        ingredients: [{ text: "bla"}]
      }
    ]},
    {name: 'Baked', text: 'bake'},
    {name: 'Pizza', text: 'pizza'}
]

… it works straight out and renders the dataview with Pasta in it. So I just need to know how to get my platters to fill their recipe data. Where (I assume in a controller on an initialize event of some sort) and how do I wire this up? And am I using the filterProperty correctly? I don’t completely understand the docs on this, but I think it generally filters on a foreign key, which I don’t have, and that the filterProperty overrides this. So that the URL will have &text=noodle appended to it.

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T15:59:52+00:00Added an answer on June 4, 2026 at 3:59 pm

    This certainly doesn’t seem to be utilising the association and store structure that I think Sencha Touch has, but even after progressing to the point of getting the recipes() association to load properly, I couldn’t ever get this to trigger the dataview to refresh. I was spending too much time on it, so I went with a less elegant solution. I pass the filter text to a setter on the Platter which sets it’s store with this filter in the param. It works at least!

    Ext.define('NC.view.PlatterDataItem', {
      extend: 'Ext.dataview.component.DataItem',
      xtype: 'platterdataitem',
    
    
      config: {
        layout: 'vbox',
        height: '130px',
        cls: 'platter',
        list: {
        },
        dataMap: {
          getList: {
            setRecipeFilters: 'text'
          }
        }
      },
    
      applyList: function(config) {
        return Ext.factory(config, NC.view.Platter, this.getList());
      },
    
      updateList: function(newList, oldList) {
        if (newList) {
          this.add(newList);
        }
    
    
        if (oldList) {
          this.remove(oldList);
        }
      }
    });
    
    Ext.define('NC.view.Platter', {
      extend: 'Ext.DataView',
      xtype: 'platter',
    
    
      config: {
        layout: 'vbox',
        height: '130px',
        itemCls: 'platter-item',
        itemTpl:  '<div class="thumb"><tpl if="image != null"><img src="{image}" /></tpl></div>'+
                  '<div class="name">{name}</div>',
        inline: {
          wrap: false
        },
        scrollable: {
          direction: 'horizontal',
          directionLock: true
        }
      },
    
      setRecipeFilters: function(text) {
        var store = Ext.create('Ext.data.Store', {
          model: 'NC.model.Recipe',
          autoLoad: true,
          proxy: {
            type: 'jsonp',
            url: 'xxxxx',
            callbackKey: 'callback',
            extraParams: {
              // credentials & text filter param
            },
            reader: {
              type: 'json',
              idProperty: 'uuid',
            }
          }
        });
    
        this.setStore(store);
      }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I hardly know how to state this question, let alone search for answers. But
There is so much written about unit testing but I have hardly found any
I hardly use web services, but just noticed now when I created one, the
I must be doing something wrong, but my code is very basic, hardly even
I have not hardly touched EF4, but I've used Linq to sql quite a
I have a table which stores the details of users. I can hardly have
I hardly see any pointer on the following problem related to Hibernate. This pertains
The title is hardly understandable, but I'm not sure how to summarize that another
Before I start, I should let you know that I'm hardly experienced in PHP.
I am new on iphone development and I have problem with CoreData. I hardly

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.