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. react组件(react-grid-gallery)

    react有很多好玩的组件,react-grid-gallery就是其中一个,主要处理图片展示,对图片进行放大与缩小 文档:https://www.npmjs.com/package/react-gr ...

  2. 分享到xxx

    来源百度 一.概述 百度分享代码已升级到2.0,本页将介绍新版百度分享的安装配置方法,请点击左侧列表查看相关章节. 二.代码结构 分享代码可以分为三个部分:HTML.设置和js加载,示例如下: 代码结 ...

  3. linux 获取shell内置命令帮助信息 help xx

    shell,命令解释器 shell内置命令有cd/umask/pwd等 help shell内置命令适用于所有用户获取shell内置命令的帮助信息help umaskhelp if

  4. Swiper-轮播图。

    Swiper(Swiper master)是目前应用较广泛的移动端网页触摸内容滑动js插件,可以用来做轮播和滑动. 初始化 <!DOCTYPE html> <html> < ...

  5. svn回退到具体的版本

    svn回退到具体的版本 找到项目的版本号 命令行中输入相关命令  到指定地点找到项目即可

  6. 阿里云CentOS 7服务器挂载数据盘

    本次使用的是centOS 7.4 64位操作系统 第一步:查看磁盘情况 我们发现,我总共有三个磁盘,分别为/dev/vda(100G)./dev/vdb(200G)./dev/vdc(100G),而被 ...

  7. phpcas 整合 ecms的问题

    如果有ecms整合phpCAS经验的小伙伴可以给我留言,有偿付费 需求是:ecms登录自动跳转到CAS认证(已完成),认证后直接跳转到帝国cms系统中,并保持帝国cms系统权限等都和以前一样 正常使用 ...

  8. 一、BOM 二、DOM

    一.BOM(window对象)###<1>window属性对象 window.location 当前浏览器的地址对象 window.history 浏览器访问过的地址对象 window.o ...

  9. nodejs API(一)

    不要注重版本 URL 官网所在位置:https://nodejs.org/dist/latest-v8.x/docs/api/url.html URL网址解析的好帮手: url有三个可调用的方法:ur ...

  10. Stacks And Queues

    栈和队列 大型填坑现场,第一部分的还没写,以上. 栈和队列是很基础的数据结构,前者后进先出,后者先进先出,如下图: 下面开始将客户端和具体实现分开,这样有两个好处:一是客户端不知道实现的细节,但同时也 ...