1. #1
    Sencha Premium Member
    Join Date
    Jan 2011
    Posts
    4
    Vote Rating
    2
    mgogolin is on a distinguished road

      2  

    Default Unanswered: filterFn is undefined when using hasMany association

    Unanswered: filterFn is undefined when using hasMany association


    I am having an issue when using the hasMany relationship. When loading data into the records in my store, I begin by putting in default values for some of the fields and then make requests to fill in each other field. Because of this I am often using record.set() which works fine for basic data types and hasOne associations. The issue for me occurs when updating the hasMany association. I have to call record.Item().loadRawData() which eventually complains that the filterFn is undefined.

    Here is a simplified version of my Model:
    Code:
    Ext.define('MyApp.model.MultiRequestStoreModel', {
         extend: 'Ext.data.Model',
         idProperty: 'Id',
         fields: [
              { name: 'Id', type: 'string' }, 
              { name: 'RequestsPending', type: 'int' },
              { name: 'RequestsFailed', type: 'int' }
         ],
         associations: [
            { type: 'hasOne', model: 'MyApp.model.Summary', name: 'Summary' },
            { type: 'hasMany', model: 'MyApp.model.Item', name: 'Items' }
         ]
    });
     
    Ext.define('MyApp.model.Summary, {
         extend: 'Ext.data.Model',
         idProperty: 'Id',
         fields: [
              { name: 'Id', type: 'string' },
              { name: 'Name', type: 'string' }
         ]
    );
     
    Ext.define('MyApp.model.Item, {
         extend: 'Ext.data.Model',
         idProperty: 'Id',
         fields: [
              { name: 'Id', type: 'string' },
              { name: 'Name', type: 'string' }
         ]
    );
    And here is the store that I am using to load each records parts individually (again simplified)...
    Code:
    Ext.define('MyApp.store.MultiRequestStore', {
        extend: 'Ext.data.Store',
        constructor: function(cfg) {
            var me = this;
            cfg = cfg || {};
            me.callParent([Ext.apply({
                 storeId: 'DetailsStore',
              model: ‘MyApp.model.MultiRequestStoreModel’,
              loadRecord : function ( record ) {
                   record.set( 'RequestsPending', 1 );
                      record.set( 'RequestsFailed', 0 );
                   Ext.Ajax.request({
                                url: url,
                                method: 'GET',
                                params : params,
                                scope: this,
                                success: Ext.bind( function ( response, opts, record ) {
                                     var responseJson = Ext.decode( response.responseText );
                                     record.beginEdit();                             
                                     record.Items().loadRawData(responseJson);
                                     record.set( 'RequestsPending', record.get('RequestsPending')-1 );
                                     record.endEdit();
                                     this.checkRecordLoaded( record );
                                }, this, [ record ], true ),
                                failure: Ext.bind( function ( response, opts, record ) {
                                     record.beginEdit();
                                     record.set( 'RequestsPending', record.get('RequestsPending')-1 );
                                     record.set( 'RequestsFailed', record.get('RequestsFailed')+1 );
                                     record.endEdit();
                             this.checkRecordLoaded( record );
                                }, this, [ record ], true )
                           });
              }
    It seems that when using hasMany, the store that it creates is contains a filter but the filter is never given a filterFn. This causes an error on ext-all-debug.js line 43576 saying that "fn is undefined". I am using extjs-4.1.0-gpl.

  2. #2
    Sencha User jgitter's Avatar
    Join Date
    Dec 2010
    Location
    Milwaukee, WI
    Posts
    11
    Answers
    1
    Vote Rating
    0
    jgitter is on a distinguished road

      0  

    Default


    I'm having this exact same problem... response please?
    Warning! Dates on calendar are closer than they appear!

  3. #3
    Sencha User
    Join Date
    Oct 2012
    Posts
    2
    Vote Rating
    0
    Dudboi is on a distinguished road

      0  

    Default


    Set

    Code:
    record.Items().remoteFilter = true
    before you call loadRawData.

Thread Participants: 2

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi