Results 1 to 4 of 4

Thread: ApplyPlugins method arguments; first item in array

  1. #1

    Default ApplyPlugins method arguments; first item in array

    I have a custom list which overrides the applyPlugins methods from his parent. And within this method i apply either a Paging-plugin or a Refresh-plugin. But now i want these both to be enabled so i both add them to my arguments array and pass this on using this.callParent(arr);

    But for some reason in the applyPlugins method in Component.js it only takes the first item from that array(the paging one). The refresh plugin never goes through.

    Anybody have any idea why this is and how i can apply both plugins?

  2. #2
    Sencha User joel.watson's Avatar
    Join Date
    Nov 2014
    Posts
    3,120
    Answers
    446

    Default

    Hi--

    Based on your description, it's tough to tell what might be causing that. If you can share a test case (https://fiddle.sencha.com) that demonstrates the issue, I'll be happy to take a look.

    Thanks!
    Joel

  3. #3

    Default

    Quote Originally Posted by joel.watson View Post
    Hi--

    Based on your description, it's tough to tell what might be causing that. If you can share a test case (https://fiddle.sencha.com) that demonstrates the issue, I'll be happy to take a look.

    Thanks!
    Joel
    Tbh, i'm not really sure how i can create a test case in Fiddle since it requires 2 plugins :/ What did was I extended the Ext.dataview.List and override the applyPlugins method with the following code:

    Code:
    applyPlugins: function(config) {
       var arr = [];
    
       if (!config) {
          if (this.getEnablePaging()) {
             arr.push(Ext.factory({
                   autoPaging: true,
                   loadMoreText: Locale.get(15914, 'Load more') + '...',
                   noMoreRecordsText: ''
    },
                'Ext.plugin.ListPaging'
    ));
          } 
    
    if (this.getEnableRefresh()) {
             arr.push(Ext.factory({
                   pullText: Locale.get(15952, 'Pull down to refresh...'),
                   loadedText: Locale.get(15953, 'Loaded.'),
                   loadingText: Locale.get(15954, 'Loading') + '...',
                   releaseText: Locale.get(15955, 'Release to refresh...'),
                     pullTpl: [
                         //'<div class="x-list-pullrefresh-arrow"></div>',
    '<div class="x-loading-spinner">',
                             '<span class="x-loading-top"></span>',
                             '<span class="x-loading-right"></span>',
                             '<span class="x-loading-bottom"></span>',
                             '<span class="x-loading-left"></span>',
                         '</div>',
                         '<div class="x-list-pullrefresh-wrap">',
                             '<span class="x-list-pullrefresh-message pdc-text-small">{message}</span>',
                             //'<div class="x-list-pullrefresh-updated">{updated}</div>', //Does not work correctly
    '</div>'
    ].join(''),
                     refreshFn: function() {
                        console.log('refreshFn');
                        console.log(this);
                     }
                },
                'PdC.plugin.PullRefresh'
    ));
          }
          return this.callParent(arr);
       }
       return this.callParent(config);
    },
    So when enablePaging and enableRefresh are both true it sends these in the var arr as an array. But when the callParent is called only the first one within the array is send to the parent function.

  4. #4
    Sencha User joel.watson's Avatar
    Join Date
    Nov 2014
    Posts
    3,120
    Answers
    446

    Default

    Quote Originally Posted by MonkeySleeve View Post
    Tbh, i'm not really sure how i can create a test case in Fiddle since it requires 2 plugins :/
    The listpaging and pullrefresh plugins are both available in Fiddle: https://fiddle.sencha.com

    Thanks!
    Joel

Similar Threads

  1. array of arguments vs named arguments
    By jimmifett in forum Ext.Direct
    Replies: 1
    Last Post: 22 Apr 2012, 10:01 PM
  2. Replies: 0
    Last Post: 14 Dec 2009, 1:17 PM
  3. how to use arguments of summaryRenderer method?
    By leons1220 in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 13 Oct 2008, 6:47 AM

Posting Permissions

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