1. #1
    Sencha User
    Join Date
    Dec 2011
    Posts
    19
    Vote Rating
    0
    Marrbacca is on a distinguished road

      0  

    Default Unanswered: getById don't work after additional load store

    Unanswered: getById don't work after additional load store


    I am using some custom paging with my store, so I'm manually calling store.load() with params after a correct event occurs. However, after loading additional data I can't use getById function to retrieve new records. It is returning "null" (which is strange since according to docs it should return undefined if no record is found).
    My store is loading data in json format via ajax proxy.
    So calling
    Code:
    App.stores.BookingStore.load();
    return initial data set, and I can retrieve records using getById method
    Code:
    App.stores.BookingStore.getById(int)
    after an event I call
    Code:
    App.stores.BookingStore.load({                        start: monday,
                            addRecords: true                        
    });
    and console.log(App.stores.BookingStore) show that records were pulled from json and inserted to store in correct way. But calling again getById with id on some new records returns null.
    How should I proceed, is there a method I should call after loading store with new data? Or maybe some property to set?

  2. #2
    Sencha - Services Team AndreaCammarata's Avatar
    Join Date
    Jun 2009
    Posts
    1,394
    Answers
    148
    Vote Rating
    22
    AndreaCammarata has a spectacular aura about AndreaCammarata has a spectacular aura about

      0  

    Default


    Hi Marrbacca.
    The load method is used to load the store data by its proxy, so maybe are you looking for the loadData function?
    However, can you post your model configuration?
    Sencha Inc
    Andrea Cammarata, Solutions Engineer
    CEO at SIMACS

    @AndreaCammarata
    www.andreacammarata.com
    github: https://github.com/AndreaCammarata

    TUX components bundle for Sencha Touch 2.x.x
    http://www.tux-components.com/


  3. #3
    Sencha User
    Join Date
    Dec 2011
    Posts
    19
    Vote Rating
    0
    Marrbacca is on a distinguished road

      0  

    Default


    Thanks you for your answer.
    About it, I do want to load new data using proxy because on each page I want to load new set of records from mysql so the load() method seems right for me...
    But of course, I'm posting model declaration:
    Code:
    App.models.BookingModel = Ext.regModel('BookingModel', {    idProperty: 'bookingID',
        fields: [
            'bookingID', 
            'clientID', 
            'stylistID', 
            'salonID',
            'serviceID', 
            'startDate',
            'splitStartDate',
            'splitEndDate',
            'endDate',
            'status',
            'status_name',
            'clientNotes',
            'stylistNotes',
            'reminderSent',
            'charge',
            'offset',
            'client_firstName',
            'client_lastName',
            'client_email',
            'client_phone1',
            'client_extension1',
            'client_phone2',
            'client_extension2',
            'client_workPh',
            'client_workExt',
            'client_address1',
            'client_address2',
            'client_city',
            'client_province',
            'client_country',
            'client_reminderType',
            'client_postal',
            'client_noteID',
            'client_referredBy',
            'client_quickLogin',
            'client_creationDate',
            'client_modifiedDate',
            'client_birthDate',
            'client_note',
            'service_categoryID',
            'service_name',
            'service_duration',
            'service_processDuration',
            'service_finishDuration',
            'service_cost',
            'service_clientBookable',
            'service_priceFirm',
            'service_note'
        ],
        proxy: {
            type: 'rest',
            url : 'includes/data_api',
            format: 'php',
            appendId: true,
            extraParams: {
                model: 'Booking'
            },
            reader: {
                type: 'json',
                root: 'items'
            }
        }    
    });
    Don't bother with this long field list, this is related to another issue I'm having (can't set up the belongsTo association on models)

  4. #4
    Sencha User
    Join Date
    Dec 2011
    Posts
    19
    Vote Rating
    0
    Marrbacca is on a distinguished road

      0  

    Default


    Any ideas on that?
    I found another stange thing on that
    If I do
    Code:
    App.stores.BookingStore.clearFilter();
    App.stores.BookingStore.filter('bookingID', url.token);
    App.stores.BookingStore.load();
    and then console.log(App.stores.BookingStore) I see store with one correct item in data.
    but if I do console.log(App.stores.BookingStore.data.items) it gives me empty array.
    Maybe I'm forgotting some config options or something...
    My store configuration:
    Code:
    App.stores.BookingStore = new Ext.data.Store({    model : 'BookingModel',
        sorters: 'startDate',
        autoLoad: false,
        getGroupString : function(record) {
            var dt = new Date(record.get('startDate'));
            return Ext.util.Format.date(dt, 'D Y M j');
        },
        load: function(options) {
            if (options == undefined)
                options = new Object();
            
            options.start = this.start;
            options.page = this.currentPage;
            return Ext.data.Store.superclass.load.call(this, options);
        }
    });

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar