Results 1 to 3 of 3

Thread: Is Ext.Data.JSONReader invoked when add method is called on Ext.Data.Store

  1. #1
    Sencha User
    Join Date
    Sep 2009
    Vote Rating

    Question Is Ext.Data.JSONReader invoked when add method is called on Ext.Data.Store


    I have a question regarding the add method in Store.

    When we call a add method explicitly on a Store object, do the JSONReader configured with the store gets invoked ?

    For Example,

    If the store is declared as below:

    var ExampleStore = new{
    reader: new{root:'rows',id:'id'},[
    {name: 'id', mapping:'BaseId'},
    {name: 'name'},
    {name: 'state', mapping: 'country', convert: function(v) {
    return v.split(':')[0]; }},

    If add method is invoked on this store by adding a record and then try to display the values using the Ext.grid.ColumnModel, will the JSONReader gets invoked ?

    Please give me the reply as soon as possible.

    Thanks in advance,

  2. #2
    Sencha User's Avatar
    Join Date
    Mar 2007
    DC Area =)
    Vote Rating


    If you're adding a record, no, the reader is not. It's not needed.

  3. #3
    Ext User
    Join Date
    Aug 2009
    Vote Rating


    I found out a lot more than I wanted to know about just how this code works as I was working (successfully...) to get it all to work with CF8 (ColdFusion 8). The logic really happens in Store, near the method "execute" and the methods which follow.

    1. Only read requests are actually sent through the Reader object. (readResponse.)
    2. All three of the other CRUD request-types are direct AJAX calls. add and update must return a list of records with (at least) the ID field-value, which are merged back into the store data (see realize). These use callback routines (e.g. doUpdateRecords) in Store.
    3. The Writer object, if you use one, is really only a data-translator, but its presence is significant.
    4. There are several objects involved (e.g. httpProxy) depending on your exact setup. All of them, in typical Ajaxian fashion, use callbacks. Fortunately, the code is well organized and easy to follow.

    I wrote an "Instant CRUD" posting not long ago in this forum, and am maintaining it as I work out the kinks of using ExtJS with ColdFusion-8 at our facility. Within the source code to that script ("InstantCRUD.CFC", in the zip) are a lot of comments.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts