1

当加载更多甚至火时,我需要重新分配额外的参数。但我没有任何想法

这是我的代码

List.js

Ext.define('bluebutton.view.BlueButton.TestingList', {
    extend: 'Ext.List',
    xtype: 'testinglistcard',
    requires: [
        'Ext.field.Select',
        'Ext.field.Search',
//        'bluebutton.view.BlueButton.MemberDetail',
         'Ext.plugin.ListPaging',
        'Ext.plugin.PullRefresh',
        'Ext.dataview.Override'

    ],
    config: {


        styleHtmlContent: true,
        scrollable: 'vertical',
        indexBar: true,
        singleSelect: true,
        onItemDisclosure: true,
        grouped: true,
        variableHeights : false,
          store : { xclass : 'bluebutton.store.BlueButton.Testing'},
            itemHeight :100,
        loadingText : 'loading',
        id :'testinglist',


                       plugins: [

                            { xclass: 'Ext.plugin.PullRefresh',
                                refreshFn: function() {             


                                        var transaction = Ext.ModelMgr.getModel('bluebutton.model.BlueButton.Testing');
                                        var proxy  = transaction.getProxy();
                                         proxy.setExtraParam('refresh', 'true' );

                                            Ext.getStore('testingstore').load();

                                    },

                            },

                          { 
                               xclass: 'Ext.plugin.ListPaging',
                                 autoPaging: true,
                                  loadNextPage: function() {

                                   var transaction = Ext.ModelMgr.getModel('bluebutton.model.BlueButton.Testing');
                                        var proxy  = transaction.getProxy();
                                         proxy.setExtraParam('refresh',  );

                                            Ext.getStore('testingstore').load();


                                 }

                        },
                ],



         masked: {
                xtype: 'loadmask',
                message: 'loading...'
            }, // masked

        emptyText: '<p class="no-search-results">No member record found matching that search</p>',
        itemTpl: Ext.create(
            'Ext.XTemplate',
            '<div class="tweet-wrapper">',
                '<table>',
                    '<tr>',

                        '<td>',
                        '   <div class="tweet">',
                        '       <h3>{invoiceId}</h3>',
                        '      <h3>Name: {billNumber}</h3>',
                        '       <h3>Point Avalaible : {invoiceDate} , Last Visited : {invoiceAmount}</h3>',

                        '   </div>',
                        '</td>',
                    '</tr>',
                '</table>',
            '</div>'


        ),



    },


});

Store.js

    Ext.define('bluebutton.store.BlueButton.Testing', {
    extend: "Ext.data.Store",
    requires: ['bluebutton.model.BlueButton.Testing'],
    config: {

      grouper: {
            groupFn: function (record) {
                return record.get('invoiceId')[0];
            }
        },
         model :'bluebutton.model.BlueButton.Testing',
      storeId :'testingstore',
        autoLoad: true,
          pageSize: 5,
            clearOnPageLoad: false, 

    }
});

模型.js

    Ext.define('bluebutton.model.BlueButton.Testing', {
    extend: 'Ext.data.Model',
    config: {

        idProperty: 'testingModel',
        fields: [
            {  name :'invoiceId'},
            {  name: 'billNumber' },
            {  name: 'invoiceDate' },
            {  name: 'invoiceAmount' },
            {  name :'downloadLink'},
            {  name: 'refresh' },



        ],

        proxy: {
            type: 'rest',
           url: 'http://192.168.251.108:8080/RESTFulExample/rest/json/metallica/invoicejsonPost',
            reader: 'json',
            actionMethods: {
                create: 'POST',
                read: 'GET',
                update: 'PUT',
                destroy: 'DELETE'
            },


                noCache: false, // get rid of the '_dc' url parameter

//                    extraParams: {
//                    userid: "test",
//                    // add as many as you need
//                },




            reader: {
                type: 'json',
                rootProperty: 'invoice'
            },

            writer: {
                type: 'json',

            },
        }



    }

});

当我刷新列表时,我需要将额外的参数“刷新”分配给 true。另一方面,如果加载更多事件触发,我需要将参数刷新分配为 false。请给我解决方案。谢谢

4

1 回答 1

1

我不认为你可以按照你要求的方式去做。但是您可以收听 load 事件并在那里更改刷新参数。

{
xtype: 'store',
//Your Code
listeners: {
load: function(store){
  store.getProxy.setExtraParam('refresh', false);
}
}
}

希望能帮助到你

于 2013-07-31T08:39:01.207 回答