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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:05:23+00:00 2026-05-27T01:05:23+00:00

In an ExtJS application that uses MVC design, how can you query records from

  • 0

In an ExtJS application that uses MVC design, how can you query records from a php/mysql back end or call methods on the php back end while passing objects or array data?

All of the examples I have seen of models, proxy, MVC style, show simple examples such as

myModel.load(123, ...

All it does is load record with id 123. Most of the examples also show how to create records or update existing records.

But what if I want to load a user with first name of “John”?

It looks like MAYBE I need to use a Store?

In other environments (such as AMF messaging) I usually pass objects – for example, creating a ‘User’ object or collection, setting the name, the calling something like

 userService.Load(userObject);

Then, on the server side I receive the request for “userService.load” (a method on the server), then receive the object, pull out what I need, and return a result object (or array collection).

Are there any examples on how to query using models/proxies in ExtJS?

Then, how to use objects? I thought the model would be the object and pass itself via the proxy definition?

  • 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-27T01:05:24+00:00Added an answer on May 27, 2026 at 1:05 am

    I think you got it, somehow, wrong with Model, Model is just a definition of a data Model, think of it as a row definition on the client side, lets use some example:

    We have on our backend a table for the orders, we might represent it on the frontend with a Model, like this:

    var orders = Ext.define('Orders'. {
                extend: 'Ext.data.Model',
                fields:['id', 'user_id', 'qty', 'item_ordered'],
                proxy: { 
                           type:' ajax', 
                           url: 'orders.php',
                           reader: {
                                       type: 'json',
                                       root: 'orders'
                                   }
                       }
            });
    

    That is a really simple Model, now, if i want to fetch just one order at the time, i can use the model to do it, like this:

    var order = Ext.ModelManager.getModel('Orders');
    order.load(1); //This will load the order with id = 1
    

    But, on the other hand if i want to get all the orders (ex, for a user), i’ll do it with a Store, stores manage collection of models, we can say its a view of a table with a collection of rows composed of structured data that you can define in your Model, lets define a simple store that use our model:

    var ordersStore = Ext.create('Ext.data.Store', {
                model:'Orders',
                proxy: {
                           type: 'ajax',
                           url : 'orders.php',
                           reader: {
                                       type: 'json',
                                       root: 'orders'
                                   }
                       }
        });
    /* This should get us our orders for the user with id=1 and also answer your
    question about how to get a user with name = 'John', you can do it in the same way */
    ordersStore.load({params:{user_id:1}});
    

    That’s about fetching data, how do you handle in your server with PHP, well, i believe that is another question.
    About the ´Model´ passing itself via ´Proxy´ that is true when adding or updating ej:

    order.set('qty', 4);
    order.save(); // This will pass the 'Order' Model to the server.
    

    Or:

    var newOrder = Ext.create('Order', {user_id:1, qty: 2, item_ordered: 66});
    newOrder.save(); // This will pass the 'Order' Model to the server too.
    

    Here you can get some more info about it too:
    Ext Store docs
    Ext Model docs

    I hope this will get you started with Models and Stores.

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

Sidebar

Related Questions

I have a web application that uses Ext-JS 2.2. In a certain component, we
I'm using a ExtJS DateField control in an ASP.NET MVC web application. I've set
We are writing an ExtJS application that relies in large measure on trapping a
We are using ExtJS for a webapplication. In that application, we use the standard
I'm using ExtJS to make a form that generates a report from the data
I am a PHP and ExtJS user. I am looking into developing an application
Our application at work uses the ExtJS (Sencha) framework for the UI. The problem
I have an application that places several Windows within a com.extjs.gxt.desktop.client.Desktop. I need to
I am trying to build a quick application with Java/Hibernate that uses Google Maps
I'm trying to learn the new MVC architecture that ExtJS 4 is using and

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.