Results 1 to 5 of 5

Thread: Store proxy isn't inserting all records

  1. #1

    Default Store proxy isn't inserting all records

    This is my store:

    Code:
    Ext.define("Web.store.GridOrderTickets", {
        extend: 'Ext.data.Store',
        storeId: 'GridOrderTickets',
        model: 'Web.model.GridOrderTicket',
        proxy: {
            type: 'ajax',
            timeout: 300000,
            headers: {
                'Accept': 'application/json; charset=utf-8'
            },
            url: '/api/Orders',
            limitParam: undefined,
            startParam: undefined,
            pageParam: undefined,
            noCache: true,
            actionMethods: {
                create: 'POST',
                read: 'GET',
                update: 'PUT',
                destroy: 'DELETE'
            },
            batchActions: true,
            writer: new Ext.data.writer.Json({
                allowSingle: false
            }),
            reader: new Ext.data.reader.Json({
                rootProperty: 'Response'
            })
        },
        autoLoad: true
    });
    I have 1601 records that come in from my api but the store is only inserting 1288 of those records. And they are all getting through, because in the load event, the records parameter is showing all 1601 records.

    Does anyone know why not all of them would be inserted?

  2. #2
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,257
    Answers
    759

    Default

    Are there duplicate ids?

    Side note, don't use new for the writer/reader.
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

  3. #3

    Default

    Figured out that the id field we were using was not an int, but an alphanumeric string. And our id field expected int, so it was slicing the back parts of the ids that couldn't parse and therefore getting duplicate ids.

    On the side note, @evant, why should the writer/reader not be used with new?

  4. #4
    Ext JS Premium Member
    Join Date
    Nov 2007
    Location
    Greetings from Sol : Earth : Europe : Germany : MV : Rostock : Sdstadt
    Posts
    39

    Default

    Quote Originally Posted by GoonPontoon View Post
    On the side note, @evant, why should the writer/reader not be used with new?
    Because you never should use new. Your code creates one reader and one writer shared by all instances of GridOrderTickets. That my causes som trouble. Besides the reader and the writer are instanciates while creating the class and not while creating the object.

    Instead use this:

    Code:
    writer: {
        type: 'json',
        allowSingle: false
    },
    reader: {
        type: 'json',
        rootProperty: 'users'
    }
    t34

  5. #5

    Default

    I haven't had any problems with it, but I also only ever have one instance of GridOrderTickets. So you are saying this way basically makes them static methods of the class, right? Is there something I'm missing here as to why that's inherently bad?

Similar Threads

  1. Replies: 1
    Last Post: 27 Feb 2015, 11:26 AM
  2. Replies: 1
    Last Post: 4 Apr 2013, 12:26 PM
  3. Fetch all records from store using localstorage proxy
    By deepakse in forum Sencha Touch 2.x: Q&A
    Replies: 3
    Last Post: 15 Feb 2013, 10:59 AM
  4. Removing records from a store using an AJAX proxy
    By urk in forum Sencha Touch 1.x: Discussion
    Replies: 3
    Last Post: 8 Feb 2012, 1:03 AM

Tags for this Thread

Posting Permissions

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