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 6329399
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T17:39:23+00:00 2026-05-24T17:39:23+00:00

I am using Sencha Touch to display nested (associated) model data in a list

  • 0

I am using Sencha Touch to display nested (associated) model data in a list template but I can only get the root model data to display. My models are an Appointment which belongs to a Customer, and Customers have many Appointments. My model code:

Customer = Ext.regModel('Customer', {
hasMany: { model: 'Appointments', name: 'appointments' },
fields: [
  { name: 'id', type: 'integer' },
  { name: 'firstName', type: 'string' },
  { name: 'lastName', type: 'string' },
  { name: 'email', type: 'string' },
  { name: 'secondary_email', type: 'string' },
  { name: 'homePhone', type: 'string' },
  { name: 'mobilePhone', type: 'string' },
  { name: 'dob', type: 'date', dateFormat: 'Y-m-d' },
  { name: 'allowLogin', type: 'boolean' },
  { name: 'emailReminders', type: 'boolean' },
  { name: 'reminders_to_stylist', type: 'boolean' },
  { name: 'fullName',
    convert: function(value, record) {
      var fn = record.get('firstName');
      var ln = record.get('lastName');
      return fn + " " + ln;
    } }
 ]
 });

Appointment = Ext.regModel('Appointment', {
belongsTo: { model: 'Customer', name: 'customer' },
fields: [
  { name: 'id', type: 'string' },
  { name: 'startTime', type: 'date', dateFormat: 'c' },
  { name: 'customer_id', type: 'integer' },
  { name: 'startTimeShort',
    convert: function(value, record) {
      return record.get('startTime').shortTime();
    }
  },
  { name: 'endTimeShort',
    convert: function(value, record) {
      return record.get('endTime').shortTime();
    }
  },
  { name: 'endTime', type: 'date', dateFormat: 'c' } 
]
});

And my panel using an xtype: list looks like:

var jsonPanel = {
title: "Appointments",
items: [
  {
    xtype: 'list',
    store: appointmentStore,
    itemTpl: '<tpl for="."><span id="{id}">{startTimeShort} - {endTimeShort} <tpl for="customer"><span class="customer">{firstName}</span></tpl></span></tpl>',
    singleSelect: true,
    onItemDisclosure: function(record, btn, index) {
      Ext.Msg.alert('test');
    }
  }
]
};

The nested data gets loaded from JSON and appears to be loading correctly into the store – when I debug the appointment store object loaded from the Appointment model, I see that the appointment.data.items array objects have a CustomerBelongsToInstance object and that object’s data object does contain the correct model data. The startTime and endTime fields display correctly in the list.

I have a suspicion that I am either not using the item template markup correctly, or perhaps there is some weird dependency where I would have to start from the model that has the “has many” association rather than the “belongs to” as shown in the kitchen sink demo.

I wasn’t able to find any examples that used this type of association so any help is appreciated.

  • 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-05-24T17:39:24+00:00Added an answer on May 24, 2026 at 5:39 pm

    Looks like your Customer hasmany association is assigning Appointments when it should be appointment which is the name of that model.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I can display a test ad using admob and sencha touch. But when test:false,
I'm using PhoneGap and Sencha Touch to display a form. I'm using an image
I am using Sencha Touch to capture data from a user on an iPad.
How can I set the row height in a Sencha Touch List object? I'm
I'm using sencha touch and having problems with sorting a Ext.list by number via
Using C# and System.Data.SqlClient, is there a way to retrieve a list of parameters
I am using Sencha Touch to develop a mobile version of a Bus Tracker
I am using Sencha Touch with Phonegap to bring my app to iOS. When
Team I'm creating an iphone application using Sencha Touch. I have registration form ,
I'm new to HTML5 and using sencha touch. Please anyone give me a full

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.