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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T02:44:34+00:00 2026-06-03T02:44:34+00:00

Below is a snippet from the cell-editing.js file in the Sencha.com Ext JS 4

  • 0

Below is a snippet from the “cell-editing.js” file in the Sencha.com Ext JS 4 example. I’d like to turn this xml data store into a json data store using json.get. And also get an example json file so I can turn that into dynamic json. Note, see the code block under “// create the Data Store”. Right now, it’s showing an xml format. How can this be done?

Example:

http://dev.sencha.com/deploy/ext-4.1.0-gpl/examples/grid/cell-editing.html

(version of 4.1.0 might change in future)

I did a similar thing with their treegrid.js file, but because the structure of the cell-editing example contains multiple field types (string, combobox/select, boolean, etc..), I didn’t know what the structure of the json file needed to be. Here is the treegrid.js code:

var store = Ext.create('Ext.data.TreeStore', {
    model: 'Task',
    proxy: {
        type: 'ajax',
        url: 'http://localhost:8888/TreeGrid.ashx'  // OR set to static file 'treegrid.json'
    },
    folderSort: true
});

“cell-editing.js” file:

Ext.Loader.setConfig({
    enabled: true
});
Ext.Loader.setPath('Ext.ux', '../ux');

Ext.require([
    'Ext.selection.CellModel',
    'Ext.grid.*',
    'Ext.data.*',
    'Ext.util.*',
    'Ext.state.*',
    'Ext.form.*',
    'Ext.ux.CheckColumn'
]);

Ext.onReady(function(){

    function formatDate(value){
        return value ? Ext.Date.dateFormat(value, 'M d, Y') : '';
    }

    Ext.define('Plant', {
        extend: 'Ext.data.Model',
        fields: [
            // the 'name' below matches the tag name to read, except 'availDate'
            // which is mapped to the tag 'availability'
            {name: 'common', type: 'string'},
            {name: 'botanical', type: 'string'},
            {name: 'light'},
            {name: 'price', type: 'float'},
            // dates can be automatically converted by specifying dateFormat
            {name: 'availDate', mapping: 'availability', type: 'date', dateFormat: 'm/d/Y'},
            {name: 'indoor', type: 'bool'}
        ]
    });


    // create the Data Store
    var store = Ext.create('Ext.data.Store', {
        // destroy the store if the grid is destroyed
        autoDestroy: true,
        model: 'Plant',
        proxy: {
            type: 'ajax',
            // load remote data using HTTP
            url: 'plants.xml',
            // specify a XmlReader (coincides with the XML format of the returned data)
            reader: {
                type: 'xml',
                // records will have a 'plant' tag
                record: 'plant'
            }
        },
        sorters: [{
            property: 'common',
            direction:'ASC'
        }]
    });

    var cellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
        clicksToEdit: 1
    });

    // create the grid and specify what field you want
    // to use for the editor at each header.
    var grid = Ext.create('Ext.grid.Panel', {
        store: store,
        columns: [{
            id: 'common',
            header: 'Common Name',
            dataIndex: 'common',
            flex: 1,
            editor: {
                allowBlank: false
            }
        }, {
            header: 'Light',
            dataIndex: 'light',
            width: 130,
            editor: {
                xtype: 'combobox',
                typeAhead: true,
                triggerAction: 'all',
                selectOnTab: true,
                store: [
                    ['Shade','Shade'],
                    ['Mostly Shady','Mostly Shady'],
                    ['Sun or Shade','Sun or Shade'],
                    ['Mostly Sunny','Mostly Sunny'],
                    ['Sunny','Sunny']
                ],
                lazyRender: true,
                listClass: 'x-combo-list-small'
            }
        }, {
            header: 'Price',
            dataIndex: 'price',
            width: 70,
            align: 'right',
            renderer: 'usMoney',
            editor: {
                xtype: 'numberfield',
                allowBlank: false,
                minValue: 0,
                maxValue: 100000
            }
        }, {
            header: 'Available',
            dataIndex: 'availDate',
            width: 95,
            renderer: formatDate,
            editor: {
                xtype: 'datefield',
                format: 'm/d/y',
                minValue: '01/01/06',
                disabledDays: [0, 6],
                disabledDaysText: 'Plants are not available on the weekends'
            }
        }, {
            xtype: 'checkcolumn',
            header: 'Indoor?',
            dataIndex: 'indoor',
            width: 55
        }],
        selModel: {
            selType: 'cellmodel'
        },
        renderTo: 'editor-grid',
        width: 600,
        height: 300,
        title: 'Edit Plants?',
        frame: true,
        tbar: [{
            text: 'Add Plant',
            handler : function(){
                // Create a model instance
                var r = Ext.create('Plant', {
                    common: 'New Plant 1',
                    light: 'Mostly Shady',
                    price: 0,
                    availDate: Ext.Date.clearTime(new Date()),
                    indoor: false
                });
                store.insert(0, r);
                cellEditing.startEditByPosition({row: 0, column: 0});
            }
        }],
        plugins: [cellEditing]
    });

    // manually trigger the data store load
    store.load({
        // store loading is asynchronous, use a load listener or callback to handle results
        callback: function(){
            Ext.Msg.show({
                title: 'Store Load Callback',
                msg: 'store was loaded, data available for processing',
                modal: false,
                icon: Ext.Msg.INFO,
                buttons: Ext.Msg.OK
            });
        }
    });
});

“plants.xml” file:

<?xml version="1.0" encoding="ISO-8859-1"?>
<catalog>
  <plant>
    <common>Bloodroot</common>
    <botanical>Sanguinaria canadensis</botanical>
    <zone>4</zone>
    <light>Mostly Shady</light>
    <price>2.44</price>
    <availability>03/15/2006</availability>
    <indoor>true</indoor>
  </plant>
  <plant>
    <common>Columbine</common>
    <botanical>Aquilegia canadensis</botanical>
    <zone>3</zone>
    <light>Mostly Shady</light>
    <price>9.37</price>
    <availability>03/06/2006</availability>
    <indoor>true</indoor>
  </plant>
</catalog>
  • 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-03T02:44:35+00:00Added an answer on June 3, 2026 at 2:44 am

    I was able to find some documentation in the book “Ext JS 4 First Look” on the subject for Ext-JS data stores, starting on page 82. Notice that I had to add the “root” property on the reader anonymous object. I commented out the lines for the XML format and replaced the lines with the JSON implementation. I’ve also included an example JSON file. The “light” field is a ComboBox (Ext-JS version of a select tag or drop down list). Make sure the values coincide with the values defined in the actual object.

    “cell-editing.js” file:

    // create the Data Store
    var store = Ext.create('Ext.data.Store', {
        // destroy the store if the grid is destroyed
        autoDestroy: true,
        model: 'Event',
        proxy: {
            type: 'ajax',
            // load remote data using HTTP
            //url: 'plants.xml',
            url: 'plants.json',
            // specify a XmlReader (coincides with the XML format of the returned data)
            reader: {
                //type: 'xml',
                type: 'json',
                // records will have a 'plant' tag
                //record: 'plant',
                root: 'plants'
            }
        },
        sorters: [{
            property: 'common',
            direction:'ASC'
        }]
    });
    

    “plants.json” file:

    {
        "plants": [
            {
                "common": 'Bloodroot',
                "botanical": 'Sanguinaria canadensis',
                "zone": 4,
                "light": 'Mostly Shady',
                "price": 2.44,
                "availability": '03/15/2006',
                "indoor": 'true'
            },
            {
                "common": 'Bloodroot',
                "botanical": 'Sanguinaria canadensis',
                "zone": 4,
                "light": 'Mostly Shady',
                "price": 2.44,
                "availability": '03/15/2006',
                "indoor": 'true'
            }
        ]
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using the snippet below, I've attempted to extract the text data from this PDF
Below is a snippet from my build.xml file. I want to modify the file
I'd like to use the snippet below (found from https://stackoverflow.com/a/3675110/782880 ) in several places
I have this snippet from apple sample code LazyTableImages . In the code below
The following is a code snippet from a struts.xml file for Struts 2. If
I've a got a code snippet below modified from http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.webpartpages.webpart.aspx : public class WebPartBla
Below is a code snippet from the file I am working with. I will
Could someone please explain function(tx) in the code snippet below, from this page: http://www.webkit.org/demos/sticky-notes/
I am loading in a JSON feed from Facebook (snippet below). { data: [
I'm referring the below code snippet from this link : while (1) { newsockfd

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.