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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:36:26+00:00 2026-06-12T05:36:26+00:00

I am still new to ST so I am probably doing several things wrong

  • 0

I am still new to ST so I am probably doing several things wrong here but I can’t figure out where the problems are.

Problem 1
when I use the pull to refresh plug-in, I get double the data instead of it just refreshing the data. I have seen to use a propertyId and so I did to no avail. This should be simple so probably something silly I’m doing wrong.

Problem 2
I am trying to figure out the most efficient way to use the MVC architecture and I have read through the documentation and many examples. So, I don’t know if I am just not understanding clearly or need a better example. I am trying to create a simple app for now with a list that I can tap on an item and get a detailed view of that item. I will later evolve it into a more robust monster but for now I am trying to understand the basics. I finally got my close button to close the detail view when I click a list item but then I can no longer get a detail view when tapping another item. I have read that this is due to ‘autoDestroy: off’ not being present but I tried that, also with no luck. I want to be able to create certain buttons like ‘close’ that I can put in multiple views and just have to have the logic in the controllers.

Main View

Ext.define('SenchaFirstApp.view.DistributorView', {
     //      extend: 'Ext.form.Panel',
     extend: 'Ext.Container',
       requires: ['SenchaFirstApp.store.DistributorStore', 'Ext.dataview.List', 'Ext.Toolbar', 'Ext.form.Panel'],
       model: 'SenchaFirstApp.model.Distributors',
       alias: 'widget.mainlist',
       xtype: 'mainlist',
       config:
       {
           layout: 'fit',
           border: 5,
           title: 'Distributors',
           html: 'My datalist',
           autoDestroy: false,
           items:[{

               xtype: 'toolbar',
               docked: 'top',
               title: 'Distributor List',
               height: 40,
               centered: true,
               items: [
                {
                    xtype: 'button',
                    text: 'Close',
                    width: 100,
                    height: 20, 
                    name: 'close',
            //      iconCls: 'delete',
                }]
               },
           {
           autoLoad: true,
           html: ['<div class="distr"><table><tr><th>Type</th><th>Distributor</th><th>Site</th><th>Status</th><th>Active</th><th>Assigned</th><th>State                             </th><th>Schedule</th><th>Finished</th></tr></table></div>'],
           itemTpl: [ '<div class="distr"><table><tr><td>{t}</td><td>{distr}</td><td colspan="2">{site}</td><td>{status}</td>                                                       <td>{active}</td><td>{assigned}</td> <td>{state}</td><td>{schedule}</td><td>{finished}</td></tr></table></div>' ],
           xtype: 'list',
           store: 'DistrID', 
            plugins: [
    {
        xclass: 'Ext.plugin.PullRefresh',
        pullRefreshText: 'Pull down to refresh Distributor List'
    }],
           ui: 'showDetails',
           id: 'mainlist',
           autoDestroy: false,
           }          
        ]
       },          
     });

Detailed View

Ext.define('SenchaFirstApp.view.DetailView',{
      extend: 'Ext.Panel',
      requires: ['Ext.Toolbar'],
      model: 'SenchaFirstApp.model.Distributors',
      alias: 'widget.detailview',
      xtype: 'detailview',
      name: 'detail',


    config:{
         html: 'This will contain detailed information',
          xtype: 'panel',
    //    fullscreen: false,
          centered: true,
          modal: false,
          scrollable: true,
          width: 300,
          height: 200,
      },
       });

Store

Ext.define('SenchaFirstApp.store.DistributorStore', {
                        extend: 'Ext.data.Store',
                        requires: ['SenchaFirstApp.model.Distributors'],

                        config: {
                        //  xtype: 'distrlist',
                            storeId: 'DistrID',
                        model: 'SenchaFirstApp.model.Distributors',
                        autoLoad: true,
                        proxy: {
                            type: 'jsonp',
                            url:'https://ajax.googleapis.com/ajax/services/feed/load?v=1.0&q=http://gdata.youtube.com/feeds/api/users/hobbitin5/uploads&num=4',
                            reader: {
                                type: 'json',
                                rootProperty: 'responseData.feed.entries'
                            }
                        }
                            }

Controller to get detailed view

 Ext.define('SenchaFirstApp.controller.DistributorsController',{
       extend: 'Ext.app.Controller',
       config: 
       {
           refs: 
           {
               mainlist: '#mainlist',
           },
           control: 
           {
               mainlist: {
                   itemtap: 'dispDetail'
               },
           },

       //when item is tapped
         listeners: {
                itemtap: function(list, index, items, record)
               {
                   console.log('An item was tapped and the listener heard it');
               }
           }
        },
        dispDetail: function(view, record) {
                console.log('Item was tapped on the Data View');
                var oldView = this.getMainlist();       
                var curRecord = oldView.getStore(record);
                var newView = Ext.create('SenchaFirstApp.view.DetailView');
                console.log(curRecord);
                curRecord += 'other stuff';
                newView.setHtml(curRecord);
                newView.add(
        {
         xtype:  'toolbar',
         docked: 'top',
         title: 'Details',
         height: 40,
         items: [
        {
          xtype: 'button',
          text: 'Close',
          width: 100,
          height: 20,   
          name: 'close',
        }]

        }
      )
                oldView.add(newView);
            //  Ext.Viewport.add(newView)
            //  Ext.Viewport.setActiveItem(newView)
        }

       });

Controller for buttons (just close for now)

Ext.define('SenchaFirstApp.controller.NavController', {
       extend: 'Ext.app.Controller',
       config: 
       {
            refs: 
            {
                 mainlist: 'mainlist',
                 main: '#mainlist',
                closeBtn: 'button[name=close]',
                detaillist: {
                    selector: 'panel panel[name=detail] deetaillist',
                    xtype: 'detailview',
                }
            }, 
            control:
            {
                closeBtn: {
                    tap: 'closeView',
                },

                mainlist: {
                    tap: 'closeView',
                },
                detaillist: {
                    tap: 'closeView',
                }
            }
       },

       closeView: function(){

            var newView = this.getMainlist();
        //  var child = Ext.Viewport.getActiveItem();
            var child = this.getDetaillist();
            var instance = Ext.getCmp('mainlist');
            var activeIndex = instance.indexOf(instance.getActiveItem());
            var curIndex = activeIndex+1;
            var closeView = this.getDetaillist();
            console.log('Close btn clicked' + ' child: ' + this.child +  ' activeIndex: ' + activeIndex);
          // Ext.Viewport.destroy(closeView); //(child);
          newView.remove(child);
          newView.destroy();
          Ext.Viewport.add(Ext.create('SenchaFirstApp.view.DistributorView'));
`          }


})`;

Model

Ext.define('SenchaFirstApp.model.Distributors', {
       extend: 'Ext.data.Model',
       config: {
           idProperty: 'DistrID',
             fields: [
                {name: 'DistrID'},
                {name: 't', type: 'string'},
                {name: 'distr', type: 'string'},
                {name: 'group', type: 'string'},
                {name: 'site', type: 'string'},
                {name: 'status', type: 'string'},
                {name: 'active', type: 'string'},
                {name: 'assigned', type: 'string'},
                {name: 'state', type: 'string'},
                {name: 'schedule', type: 'string'},
                {name: 'finished', type: 'string'},
                //{mapping: 't',
                // name: 'DistrID'}
                ],
       }
       });

I understand that is a lot but any help is appreciated…even a nudge in the right direction. Thanks in advance! Also, I’m sure there is stuff in there that doesn’t need to be as I’ve had trouble locating good examples for what I am trying to accomplish so I have pieces here and there from different examples that I’ve tried to get to play nice together 🙁

  • 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-12T05:36:28+00:00Added an answer on June 12, 2026 at 5:36 am

    I solved the refresh issue by changing the idProperty to ‘id’ and put that in my model field list. I’m still not sure why the ‘DistrID wasn’t working but I had an ‘id’ field in my script that held the server response that I didn’t know about as I didn’t write that part. So, I would have to guess that is why it wasn’t working.

    I had read that ‘autoDestroy: false’ is what was needed to allow clicking a second time but that was wrong. When I took that property out it allowed me to continue to open and close details of list items.

    Now I just have to work on passing id’s of list items clicked to get a detailed view of that particular item. If anyone can help with that it would be great or I will post a new question. Thanks!

    I figured out how to get the list item id in case it can help anyone…
    Iny my DistributorController I simply get the store and the record id

    var store = Ext.getStore('NodeStore');
                var id = record.get('id');
    

    Then set the params and load the store

    store.getProxy().setExtraParams({id: id});
                store.load();
    

    I did also find that you can’t reference your store through the controller with refs. Instead get the store as I did above with var store = Ext.getStore(‘StoreName’);
    This is all pretty simple stuff but I’m still very knew so maybe it can help out another n00b

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

Sidebar

Related Questions

I am still a beginner but trying to learn so probably doing something extremely
EDIT: I have made a clean, new project, but still can't get it working.
Im still not getting the wicket models. What am I doing wrong here? filterString
I am still new at SAS and I was wondering how I can do
i am still new to the Java language and libraries... i often use this
I'm still new to code igniter and I'm having problems getting the login system
Probably a stupid question but I'm still trying to wrap my head around nHibernate.
I'm very sure this problem has been solved, but I can't find any information
I'm still learning Perl, so there's probably a more efficient way of doing this.
This is probably a dumb question, but I'm brand new to git and am

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.