PDA

View Full Version : How to override Ext.plugins.PullRefreshPlugin for a different language?



PHANTOMIAS
21 Oct 2011, 6:59 AM
Hello all!

I am using Sencha Touch v1.1.1 and the pull refresh feature in my list.
It is defined in this way in "sencha-touch-debug.js":

Ext.plugins.PullRefreshPlugin = Ext.extend(Ext.util.Observable, {
pullRefreshText: 'Pull down to refresh...',
releaseRefreshText: 'Release to refresh...',
loadingText: 'Loading...',
snappingAnimationDuration: 150,
refreshFn: null,
pullTpl: new Ext.XTemplate(
'<div class="x-list-pullrefresh">',
'<div class="x-list-pullrefresh-arrow"></div>',
Ext.LoadingSpinner,
'<div class="x-list-pullrefresh-wrap">',
'<h3 class="x-list-pullrefresh-message">{message}</h3>',
'<div class="x-list-pullrefresh-updated">Last Updated: <span>{lastUpdated:date("m/d/Y h:iA")}</span></div>',
'</div>',
'</div>'
),


...
});
Ext.preg('pullrefresh', Ext.plugins.PullRefreshPlugin);

What I want to do is to override for example "pullTpl", "pullRefreshText", "releaseRefreshText" and "loadingText" so I can translate it in a different language.

What's the best way to do this?

PHANTOMIAS
24 Oct 2011, 6:26 AM
No one has an idea how to solve this? Can I override these properties?

danishrulez
24 Oct 2011, 7:21 AM
How do you register it on your list component? I can't even get it to fire.

PHANTOMIAS
24 Oct 2011, 8:42 AM
You can write:

plugins: [{
ptype: 'pullrefresh'
}]

I solved the problem. You have to register and then you can override the properties.

danishrulez
24 Oct 2011, 9:45 AM
I used the very same code. I don't even get an error message in the console.

PHANTOMIAS
24 Oct 2011, 10:45 AM
Did you include the Sencha Touch JavaScript files? Search for "pullrefresh" and check if it is included, but it should be in version 1.1.1. Otherwise search for "Ext.plugins.PullRefreshPlugin".

danishrulez
24 Oct 2011, 1:33 PM
Yes, but it turned out to be a caching issue in my browser.