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

  • Home
  • SEARCH
  • 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 6389023
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T03:21:09+00:00 2026-05-25T03:21:09+00:00

Developing a Sencha Touch MVC app that pulls data from json store (thats set

  • 0

Developing a Sencha Touch MVC app that pulls data from json store (thats set up to a DB pulling out content from a WordPress Blog).

Everything works up until my “detail” panel. Instead of it listening to the TPL, its just dumping some data. The data looks similar to my blog post, but is filled with other code and doesn’t make much sense.

Here is a lean version of my list:

    myApp.views.PostListView = Ext.extend(Ext.Panel, {

    postStore: Ext.emptyFn,
    postList: Ext.emptyFn,
    id:'postlistview',
    layout: 'card',

    initComponent: function () {

       /* this.newButton = new Ext.Button({
            text: 'New',
            ui: 'action',
            handler: this.onNewNote,
            scope: this
        });*/

        this.topToolbar = new Ext.Toolbar({
            title: 'All Posts',
           /* items: [
                { xtype: 'spacer' },
                this.newButton
            ],*/
        });


        this.dockedItems = [ this.topToolbar ];

        this.postList = new Ext.List({
            store: myApp.stores.postStore,
            grouped: true,
            emptyText: '<div style="margin:5px;">No notes cached.</div>',
            onItemDisclosure: true,
            itemTpl: '<div class="list-item-title">{title}</div>' +
                            '<div class="list-item-narrative"><small>{body}</small></div>',

        });

        this.postList.on('disclose', function (record) {
            this.onViewPost(record);
        }, this),

        this.items = [this.postList];

        myApp.views.PostListView.superclass.initComponent.call(this);
    },
    onViewPost: function (record) {
        Ext.dispatch({
            controller: myApp.controllers.masterController,
            action: 'viewpost',
            post: record
        });
    },
});

And here is the “detail” view that is called on disclosure:

myApp.views.PostSingleView = Ext.extend(Ext.Panel, { 

    title:'Single Post',
    id:'postsingleview',
    layout:'card',
    style:'background:grey;',

    initComponent: function () {

        this.new1Button = new Ext.Button({
            text: 'Back',
            ui: 'back',
            handler: this.onViewList,
            scope: this,
            dock:"left"
        });

        this.top1Toolbar = new Ext.Toolbar({
            items: [
                this.new1Button
            ],

            title: 'Single Posts',
        });

        this.postSinglePanel = new Ext.Panel({
            layout:'fit',
            flex:1,
            scroll: 'vertical',
            style:'padding:10px;background:yellow;',
            itemTpl: '<tpl for=".">' +
                        '<div class="list-item-narrative">{body}</div>' +
                     '</tpl>',
        });

        this.dockedItems = [ this.top1Toolbar, this.postSinglePanel ];

        myApp.views.PostSingleView.superclass.initComponent.call(this);
    },

    onViewList: function () {
        Ext.dispatch({
            controller: myApp.controllers.masterController,
            action: 'viewlist',

        });
    },
});

And here is the controller that its talking to:

    Ext.regController('masterController', {


    'index': function (options) {

        if (!myApp.views.mainView) {
            myApp.views.mainView = new myApp.views.MainView();
        }

        myApp.views.mainView.setActiveItem(
            myApp.views.postView
        );
    },

    'viewpost': function (options) {

        myApp.views.postSingleView.postSinglePanel.update(options.post);
        myApp.views.postView.setActiveItem(
            myApp.views.postSingleView,
            { type: 'slide', direction: 'left' }
        );
    },

});

myApp.controllers.masterController = Ext.ControllerManager.get('masterController');

When the data comes out, it looks similar to this:

https://i.stack.imgur.com/fJAVh.png

(the black boxes are “redacted” content, no error code there).

In closing, I believe that the controller is “dumping” the data into “MyApp.views.PostSingleView” rather than formatting it as I request in the TPL, though I’m not sure how to fix it. Any and all help MUCH appreciated!

UPDATE: As requested, here is the RegModel:

    Ext.regModel("CategoryModel", {
    fields: [
        {name: "id", type: "int"},
        {name: "title", type: "string"},
        {name: "body", type: "string"},
    ],
    hasMany: {
        model: 'Post',
        name: 'posts'
    }
});

And here is a sample of the json:

{
   "status":"ok",
   "post":{
      "id":1037,
      "type":"post",
      "slug":"post-title",
      "url":"http:\/\/localhost:8888\/jsontest\/PostTitle\/",
      "status":"publish",
      "title":"Post Title",
      "title_plain":"Post Title",
      "content":"<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.<br \/>\nLorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.<\/p>\n<!-- PHP 5.x -->",
      "excerpt":"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat [...]",
      "date":"2011-07-29 14:17:31",
      "modified":"2011-08-30 01:33:20",
      "categories":[
         {
            "id":87,
            "slug":"the-category",
            "title":"The Category",
            "description":"",
            "parent":17,
            "post_count":5
         }
      ],
      "tags":[

      ],
      "author":{
         "id":2,
         "slug":"tom",
         "name":"tom",
         "first_name":"tom",
         "last_name":"",
         "nickname":"",
         "url":"",
         "description":""
      },
      "comments":[

      ],
      "attachments":[

      ],
      "comment_count":0,
      "comment_status":"open"
   },
   "previous_url":"http:\/\/localhost:8888\/jsontest\/next-post\/",
   "next_url":"http:\/\/localhost:8888\/jsontest\/prev-post\/"
}
  • 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-25T03:21:10+00:00Added an answer on May 25, 2026 at 3:21 am

    Use the tpl config option of the Ext.Panel not the itemTpl which doesn’t exist.

    As someone has mentioned before, be careful when using a Model instance and the update method, you will need to use the model’s data property.

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

Sidebar

Related Questions

I'm developing a Sencha Touch application that has multiple data stores. In order to
When developing an application that sends out notification email messages, what are the best
Developing a web application that I've registered with Twitter. In this app, I might
I am looking at sencha touch framework as an option for developing a mobile
Developing a .net library based on an industry standard. The standard includes data structures
Developing a little survey webapp, ran into problem that deals with ranges for rating
When developing a blackberry app originally, I didn't pay much attention to being able
We´re developing an ASP MVC application witch the View (aspx) has a Flex embed.
Developing for WM 6, I call CreateWindow with hWndParent set to the window I
Developing Java, you have always learned that its best to create an ArrayList by

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.