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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:37:43+00:00 2026-05-26T15:37:43+00:00

Model: app.models.Category = Ext.regModel(Category, { fields: [ { name: ‘CategoryId’, type: ‘int’ }, {

  • 0

Model:

app.models.Category = Ext.regModel("Category", {
    fields: [
        { name: 'CategoryId', type: 'int' },
        { name: 'ImageUrl', type: 'string' },
        { name: 'ImageUrlFile', type: 'string' },
        { name: 'CategoyName', type: 'string' }
    ]
});

Storage:

app.stores.CategoryStore = new Ext.data.Store({
    id: 'CategoryStore',
    model: 'Category',
    autoLoad: true,
    proxy: {
        type: 'scripttag',
        url: 'http://localhost:1303/admin/categoriesservice/getcategories',
        mehod: 'GET', //not needed
        callbackKey: 'callback', //not needed
        reader: {
            type: 'json',
            root: 'categories'//not needed with my JSONP
        },
        afterRequest: function (request, success) {
            console.log("afterRequest");
            if (success) {
                console.log("success");
            } else {
                console.log("failed");
            }
            console.log(request);
        }
    }
});

Controller:

Ext.regController('Home', {
    index: function () {
        if (!this.indexView) {
            this.indexView = this.render({
                xtype: 'HomeIndex'
            });
            this.items = [app.views.HomeIndex];
        }
        app.viewport.setActiveItem(this.indexView);//this what i've missed
    }
});

View

app.views.HomeIndex = Ext.extend(Ext.DataView, {
    html: '<div class="gallery-view" style="display: block;width: 300px;border: 1px solid #fff;height: 300px;"></div>',
    store: app.stores.CategoryStore, //full namespace needed
    itemSelector: 'div.node',
    initComponent: function () {
        this.tpl = new Ext.XTemplate(
                    '<div style="padding:10px 5px 5px 5px;">',
                        '<tpl for=".">',
                            '<div class="node" style="background:url({ImageUrl});">',
                            '</div>',
                        '</tpl>',
                    '</div>'
        );
    //appened to successful solution 
    this.dataView = new Ext.DataView({
        store: this.store,
        tpl: this.xtpl,
        itemSelector: 'div.node'
    });
    this.items = [this.dataView];
        app.views.HomeIndex.superclass.initComponent.apply(this, arguments);
    }
});
Ext.reg('HomeIndex', app.views.HomeIndex);

JSONP Result:

GetCategories([{"CategoryId":101,"CategoyName":"אוכל","ImageUrl":"http://www.teleclal.com/YnetApplicationMall/Content/images/categories/rest.png","ImageUrlFile":null,"InsertDate":"\/Date(1314507534000)\/","IsActive":true,"ApplicationId":0,"Applications":null},{"CategoryId":99,"CategoyName":"הצגות ומופעים","ImageUrl":"http://www.teleclal.com/YnetApplicationMall/Content/images/categories/shows.png","ImageUrlFile":null,"InsertDate":"\/Date(1314442037000)\/","IsActive":true,"ApplicationId":100,"Applications":null},{"CategoryId":111,"CategoyName":"בריאות","ImageUrl":"http://www.teleclal.com/YnetApplicationMall/Content/images/categories/spa.png","ImageUrlFile":null,"InsertDate":"\/Date(1314856845000)\/","IsActive":true,"ApplicationId":0,"Applications":null},{"CategoryId":142,"CategoyName":"נופש ותיירות","ImageUrl":"http://www.teleclal.com/YnetApplicationMall/Content/images/categories/vacation.png","ImageUrlFile":null,"InsertDate":"\/Date(1314713031000)\/","IsActive":true,"ApplicationId":0,"Applications":null},{"CategoryId":143,"CategoyName":"ביגוד","ImageUrl":"http://www.teleclal.com/YnetApplicationMall/Content/images/categories/clothes.png","ImageUrlFile":null,"InsertDate":"\/Date(1314713031000)\/","IsActive":true,"ApplicationId":0,"Applications":null},{"CategoryId":144,"CategoyName":"אתרים ואטרקציות","ImageUrl":"http://www.teleclal.com/YnetApplicationMall/Content/images/categories/attraction.png","ImageUrlFile":null,"InsertDate":"\/Date(1314713031000)\/","IsActive":true,"ApplicationId":0,"Applications":null},{"CategoryId":105,"CategoyName":"חשמל","ImageUrl":"http://www.teleclal.com/YnetApplicationMall/Content/images/categories/elctronic.png","ImageUrlFile":null,"InsertDate":"\/Date(1314713031000)\/","IsActive":true,"ApplicationId":0,"Applications":null}]);

The exception:
Uncaught TypeError: Cannot read property ‘length’ of undefined

Question:
Help how can i parse via storage or any other way the JSONP issue???

  • 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-26T15:37:43+00:00Added an answer on May 26, 2026 at 3:37 pm

    when I tried to define

    function GetCategories(data){console.log(data);}
    

    and then invoking the jsonp response (by ctrl+c/ctrl+v into the console), I was successful, meaning the the data is a valid json string.
    but when I inspected your code, I haven’t seen a mechanisem that defines that function (GetCategories).

    I must say that i’m unfamilier with sencha. but I aswsome that problem is that no callback function was ever created.

    I see that you define a ‘callbackKey: ‘callback”
    is there somewhere in sencha documentation that allows you to define a ‘callbackValue: ‘GetCategories” or such? try and check into that direction.

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

Sidebar

Related Questions

I have 2 models, Post and Category: class Category(models.Model): # some fields class Post(models.Model):
class Category(models.Model): name = models.CharField(max_lenth=50) class SubCatergory(models.Model): parent_category = models.ForeignKey(Category) name = models.CharField(max_length=100) class
I have this model: class Category(models.Model): name = models.CharField() description = models.CharField(blank=True) parent =
models.py class Category(models.Model): name = models.CharField(max_length=200) slug = models.SlugField() parent = models.ForeignKey('self', blank=True, null=True,
In my Django App I have the following model: class SuperCategory(models.Model): name = models.CharField(max_length=100,)
I have a django app with models as follows: A Question model An Answer
Here's part of my Django app's models.py : class Person(models.Model): birth_year = WideYear(null=True, blank=True)
I have a Rails app with a few model classes (e.g. Category , Subcategory
I'm working on an app with a Model hierarchy of Campaign > Category >
I have the following models. # app/models/domain/domain_object.rb class Domain::DomainObject < ActiveRecord::Base has_many :links_from, :class_name

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.