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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:44:47+00:00 2026-06-04T07:44:47+00:00

I have my model as this: Ext.define(NotesApp.model.Note, { extend: Ext.data.Model, config: { idProperty: ‘id’,

  • 0

I have my model as this:

Ext.define("NotesApp.model.Note", {
    extend: "Ext.data.Model",
    config: {
        idProperty: 'id',
        fields: [
            { name: 'id', type: 'int' },
            { name: 'dateCreated', type: 'date', dateFormat: 'c' },
            { name: 'question', type: 'string' },
            { name: 'answer', type: 'string' },
            { name: 'type', type: 'int'},
            { name: 'author', type: 'int'}
        ],
        validations: [
            { type: 'presence', field: 'id' },
            { type: 'presence', field: 'dateCreated' },
            { type: 'presence', field: 'question', message: 'Please enter a question for this card.' }
        ]
    }
});

and my server page (qa.php) outputs this:

{"results":[{"id":"1","dateCreated":"2012-05-01","question":"asdf?","answer":"fdsa","type":"0","author":"0"},{"id":"2","dateCreated":"2012-05-01","question":"qwer?","answer":"rewq","type":"0","author":"0"}]}

and this is my code in the store:

Ext.define("NotesApp.store.Online", {
    extend: "Ext.data.Store",
           config: {
           model: 'NotesApp.model.Note',
           storeId: 'Online',
           proxy: {
               type: 'jsonp',
               url: 'http://xxxxxxxx.com/qa.php',
               reader: {
                   type: 'json',
                   rootProperty: 'results'
               }
           },
           autoLoad: false,
           listeners: {
               load: function() {   
                   console.log("updating");

                   Ext.getStore('Notes').getProxy().clear();
                   console.log("updating1");

                   // Loop through records and fill the offline store                       

                   this.each(function(record) {
                             console.log("updating2");
                             Ext.getStore('Notes').add(record.data);

                   });

                   // Sync the offline store
                   Ext.getStore('Notes').sync();
                   console.log("updating3");
                   // Remove data from online store
                   this.removeAll();
                    console.log("updated");
               }

           },
           fields: [
                    {
                    name: 'id'
                    },
                    {
                    name: 'dateCreated'
                    },
                    {
                    name: 'question'
                    },
                    {
                    name: 'answer'
                    },
                    {
                    name: 'type'                    
                    },
                    {
                    name: 'author'
                    }
                    ]
           }
});

But when I called Ext.getStore('Online').load(), the console showed “updating”, “updating1”, and “updating3” but not any “updating2”, ie. no records were found. I wonder where the mistake is? Is there a way to output the jsonstring that’s read in?

  • 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-04T07:44:48+00:00Added an answer on June 4, 2026 at 7:44 am

    This is a different scope

    listeners: {
               load: function() {   
                   console.log("updating");
    
                   Ext.getStore('Notes').getProxy().clear();
                   console.log("updating1");
    
                   // Loop through records and fill the offline store                       
    
                   this.each(function(record) {
                             console.log("updating2");
                             Ext.getStore('Notes').add(record.data);
    
                   });
    
                   // Sync the offline store
                   Ext.getStore('Notes').sync();
                   console.log("updating3");
                   // Remove data from online store
                   this.removeAll();
                    console.log("updated");
               },
    this//adds scope
    

    or

    listeners: {
               load: function(store,record,options) {   
                   console.log("updating");
    
                   Ext.getStore('Notes').getProxy().clear();
                   console.log("updating1");
    
                   // Loop through records and fill the offline store                       
    
                   store.each(function(record) {
                             console.log("record"); //wahei records!
                             Ext.getStore('Notes').add(record.data);
    
                   });
    
                   // Sync the offline store
                   Ext.getStore('Notes').sync();
                   console.log("updating3");
                   // Remove data from online store
                   this.removeAll();
                    console.log("updated");
               }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For example I have 2 models: Ext.define('Order', { extend : 'Ext.data.Model', fields : [
Here is my model: Ext.define('A.model.Group', { extend: 'Ext.data.Model', fields:['id', 'name'], proxy: { type: 'rest',
I have a storage with models: Ext.define('App.Supplier.Store', { extend : 'Ext.data.Store', constructor : function(config)
I have a controller with store, model and view (toolbar) : Ext.define('Cc.controller.Headers', { extend:
Let's say I have a Sencha Touch model like this: Ext.regModel('User', { 'fields': [{
I have this model var Item = Backbone.Model.extend({ url: 'http://localhost/InterprisePOS/Product/loaditembycategory/Event Materials' }); var onSuccess
I have a simple model like this one: class Artist(models.Model): surname = models.CharField(max_length=200) name
Say I have a SqlAlchemy model something like this: from sqlalchemy.ext.declarative import declarative_base from
I have a Model called Version that looks like this: from google.appengine.ext import db
I have 'Movie' model and hold data in Ext.data.Store. Movies are displayed in gridPanel.

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.