Sencha removed the refreshFn from the pullrefresh plugin in ST 2.2. Here is an user extension with gives the old
functionality back to you.

/**
* This user extension gives st 2.3.0 Pullrefresh the RefreshFn back
* based on sencha touch 2.3.0
*
* @class Ext.ux.touch.PullRefreshFn
* @version 2.0.1-beta
* @author Martin Hess <https://github.com/p5hema2>
*
* ## Example
*
* Ext.create('Ext.dataview.List', {
* fullscreen: true,
*
* store: store,
*
* plugins: [
* {
* xclass: 'Ext.ux.touch.PullRefreshFn',
* pullRefreshText: 'Pull down for more new Tweets!'
* refreshFn: function() {
* Ext.getStore('ENTER YOUR STORE HERE').load('',1)
* }
* }
* ],
*
* itemTpl: [
* 'YOUR ITEMTPL'
* ]
* });
*/
Ext.define('myapp.model.PullRefreshFn', {
extend: 'Ext.plugin.PullRefresh',
alias: 'plugin.pullrefreshfn',
requires: ['Ext.DateExtras'],
xtype:'refreshFn', config: {
/**
* @cfg {Function} refreshFn The function that will be called to refresh the list.
* If this is not defined, the store's load function will be called.
* The refresh function gets called with a reference to this plugin instance.
* @accessor
*/
refreshFn: null,
pullText: '下拉能够更新',
lastUpdatedText:"上次刷新时间",
lastUpdatedDateFormat:"Y-m-d H:i",
releaseText:"松开開始更新",
loadedText:"载入完毕"
}, fetchLatest: function() {
if (this.getRefreshFn()) {
this.getRefreshFn().call(this, this);
this.setState("loaded");
this.fireEvent('latestfetched', this, 'refreshFn, you have to handle toInsert youself');
if (this.getAutoSnapBack()) {
this.snapBack();
}
} else {
console.log('fetchLatest')
var store = this.getList().getStore(),
proxy = store.getProxy(),
operation; operation = Ext.create('Ext.data.Operation', {
page: 1,
start: 0,
model: store.getModel(),
limit: store.getPageSize(),
action: 'read',
sorters: store.getSorters(),
filters: store.getRemoteFilter() ? store.getFilters() : []
}); proxy.read(operation, this.onLatestFetched, this);
}
}, /**
* Snaps the List back to the top after a pullrefresh is complete
* @param {Boolean=} force Force the snapback to occur regardless of state {optional}
*/
snapBack: function(force) {
if(this.getState() !== "loaded" && force !== true) return; var that = this,
list = this.getList(),
scroller = list.getScrollable().getScroller(),
currentY = scroller.minPosition.y; scroller.refresh();
scroller.minPosition.y = 0; scroller.on({
scrollend: this.onSnapBackEnd,
single: true,
scope: this
}); this.setIsSnappingBack(true); scroller.getTranslatable().translateAnimated(0, currentY, {duration: this.getSnappingAnimationDuration()});
setTimeout(
function () {
scroller.scrollTo(0,1);
scroller.scrollToTop();
},
that.getSnappingAnimationDuration()
); }
});

sencha 2.3中自己定义PullRefreshFn给PullRefresh加入下拉刷新事件的更多相关文章

  1. android--------自定义控件ListView实现下拉刷新和上拉加载

    开发项目过程中基本都会用到listView的下拉刷新和上滑加载更多,为了方便重写的ListView来实现下拉刷新,同时添加了上拉自动加载更多的功能. Android下拉刷新可以分为两种情况: 1.获取 ...

  2. 【Android-自定义控件】SwipeRefreshDemo 下拉刷新,上拉加载

    参考:https://github.com/PingerOne/SwipeRefreshDemo 谷歌官方的SwipeRefreshLayout控件,只有下拉刷新功能. 自定义的SwipeRefres ...

  3. 【转载】Android中ListView下拉刷新的实现

    在网上看到一个下拉刷新的例子,很的很棒,转载和更多的人分享学习 原文:http://blog.csdn.net/loongggdroid/article/details/9385535 ListVie ...

  4. Android中ListView下拉刷新的实现

    ListView中的下拉刷新是非常常见的,也是经常使用的,看到有很多同学想要,那我就整理一下,供大家参考.那我就不解释,直接上代码了. 这里需要自己重写一下ListView,重写代码如下: packa ...

  5. Android 它们的定义ListView实现底部和页下拉刷新刷新的顶

    在项目开发.由于数据量过大,寻呼需要加载或下拉刷新.为了缓解长期等待-time负载.这个博客的评论中被自己的定义实例ListView实现底部的下拉刷新页面正在加载结果和顶部. 其效果图: 一.List ...

  6. Android-自定义ListView下拉刷新与上拉加载

    效果图: 第一步:编写需要在ListView中增加头加载的布局文件,与底部加载的布局文件: 头布局文件: <?xml version="1.0" encoding=" ...

  7. Android中实现下拉刷新

    需求:项目中的消息列表界面要求实现类似sina微博的下拉刷新: 思路:一般的消息列表为ListView类型,将list加载到adapter中,再将adapter加载到 ListView中,从而实现消息 ...

  8. Android自己定义控件--下拉刷新的实现

    我们在使用ListView的时候.非常多情况下须要用到下拉刷新的功能.为了了解下拉刷新的底层实现原理,我採用自己定义ListView控件的方式来实现效果. 实现的基本原理是:自己定义ListView, ...

  9. SuperSwipeRefreshLayout 一个功能强大的自己定义下拉刷新组件

    SuperSwipeRefreshLayout 一个功能强大的自己定义下拉刷新组件. Why? 下拉刷新这样的控件.想必大家用的太多了,比方使用非常多的XListView等. 近期.项目中非常多列表都 ...

随机推荐

  1. A Complete Tutorial to Learn Data Science with Python from Scratch

    A Complete Tutorial to Learn Data Science with Python from Scratch Introduction It happened few year ...

  2. 专访周金可:我们更倾向于Greenplum来解决数据倾斜的问题

    周金可,就职于听云,维护MySQL和GreenPlum的正常运行,以及调研适合听云业务场景的数据库技术方案. 听云周金可 9月24日,周金可将参加在北京举办的线下活动,并做主题为<GreenPl ...

  3. JSON学习笔记-1

    1.什么是JSON? JSON(JavaScript Object Notation, JS 对象简谱) 是一种轻量级的数据交换格式.它基于 ECMAScript (欧洲计算机协会制定的js规范)的一 ...

  4. linux 权限管理命令chown、chgrp、umask、linux新建文件或目录的默认权限755

    chown /bin/chownchown [用户] [文件或目录] 改变文件或目录的所有者只有root可以改变文件或目录的所有者 root用户:mkdir /tmptouch /tmp/test.f ...

  5. Oracle存储过程简单实例

    转自 http://www.cnblogs.com/nicholas_f/articles/1526029.html /*不带任何参数存储过程(输出系统日期)*/create or replace p ...

  6. [WSUS] [Windows 10 Upgrade 1607/1703] 升级出错,出现 0xC1800118 或者卡在下载中…… 0%后失败

    1. 安装 KB3159706 ,并进行安装后维护操作:https://support.microsoft.com/en-us/help/3159706/update-enables-esd-decr ...

  7. [翻译] DCPathButton

    DCPathButton https://github.com/Tangdixi/DCPathButton DCPathButton 2.0 is a menu button for iOS. Des ...

  8. SQL语言DDL DML DCL TCL四种语言

    1.DDL(Data Definition Language)数据库定义语言:DDL使我们有能力创建或删 除表格.可以定义索引(键),规定表之间的链接,以及施加表间的 约束. • 常见DDL 语句: ...

  9. 通过nginx 访问 centos 7 服务器上的.Net Core

    先安装依赖 # yum -y install pcre-devel openssl openssl-devel # yum -y install gcc gcc-c++ autoconf automa ...

  10. September 20th 2017 Week 38th Wednesday

    All our dreams can come true if we have the courage to pursue them. 如果我们有勇气去追求梦想,我们的梦想一定可以成为现实. If y ...