PDA

View Full Version : The loading mask no longer automatically appears when store.load() is called.



bweiler
25 Jan 2012, 2:18 PM
Did something change between PR3 and PR4 that affects loading masks? I used to be able to call store.load() and the loading mask would automatically appear. After upgrading to PR4, the loading mask no longer appears. I'm using the Ajax proxy if that makes a difference.

rdougan
26 Jan 2012, 9:29 PM
Could you provide a testcase for us please? We have a few examples using this (kiva, twitter, list) and it all works good.

Thanks.

jsveron23
27 Jan 2012, 12:34 AM
was automatically

bweiler
27 Jan 2012, 9:42 AM
I'm using the ajax proxy with php on an internal server, so I can't provide working test code. However, I'm probably doing something obviously wrong, so maybe a couple of code segments will help. The problem may be in how I dynamically create stores.

Thanks

Here's an example of the approach I use in the controller to load the json data from a remote server using the ajax proxy.


....
var model = this.getModel('MyModel'),
proxy = model.getProxy();

store = this.buildStore(model);
myList.query('list')[0].setStore(store);

proxy.setExtraParam(); // Figure out how to reset extraParams
proxy.setExtraParam('req', 'search');
proxy.setExtraParam('q', query);

store.load();
....


Here's the helper method I use to dynamically create stores.


buildStore: function(model) {
return Ext.create('Ext.data.Store', {
model: model
});
},



Here's an example of a predefined store:


Ext.define('MyApp.store.TwitterListData', {
extend: 'Ext.data.Store',

config: {
model: 'MyApp.model.TwitterData',
}
});


Here's how I create models with PR4:


Ext.define('MyApp.model.TwitterData', {
extend: 'Ext.data.Model',

config: {
fields: [
{name: "completed_in", type: "string"},
{name: "max_id", type: "string"},
{name: "max_id_str", type: "string"},
{name: "next_page", type: "string"},
{name: "page", type: "string"},
{name: "query", type: "string"},
{name: "refresh_url", type: "string"},
{name: "results", type: "array"},
],

hasMany: [
{model: 'TwitterResults', name: 'results'},
],

proxy: {
type: 'ajax',
url: MyApp.globals.mapGlobals.phpDir + "getFeeds.php",
// ExtraParams are set in the controller
extraParams: {},
reader: 'json',
timeout: 20000,
listeners: {
exception: function(proxy, resp, oper, opts) {
console.log("MyApp.model.TweetData: exception.");
console.log(resp.statusText, ": ", resp.responseText);
},
}
}
}
});

rdougan
27 Jan 2012, 11:15 AM
Perhaps search the framework file for the following code:


onBeforeLoad: function() {
var loadingText = this.getLoadingText();
if (loadingText) {

this.setMasked({
xtype: 'loadmask',
message: loadingText
});
}
}

It is defined in src/dataview/DataView.js, but it will be a random line number if you are using the built version of the framework.

Add a debugger in there and ensure it is getting into this function. If it is not, then I will take a deeper look into this issue. Makes no sense. :)

bweiler
27 Jan 2012, 1:02 PM
I set a breakpoint and it turns out that the loadingText variable is undefined. I don't understand why this is the case. I am just calling store.load() and not doing anything special with the masks. One aspect that may be unique to my environment is the 5 to 10 second response time lags I get in some cases due to live scraping websites.



onBeforeLoad: function() {
var loadingText = this.getLoadingText();
if (loadingText) {


this.setMasked({
xtype: 'loadmask',
message: loadingText
});
}
}

rdougan
27 Jan 2012, 1:03 PM
Are you setting that configuration somewhere else? It defaults to 'Loading...' in PR4:

http://f.cl.ly/items/1Q362i1G0r1d2F3i253P/Screen%20Shot%202012-01-27%20at%201.03.08%20PM.png

bweiler
27 Jan 2012, 1:20 PM
No, I haven't specified loadingText in the list item of the view configuration. And I just tried specifying it and it didn't make a difference.

Also, the other strange thing is that the loading mask background appears normally and disappears normally after the list displays, but still no loading mask spinner is displayed.

rdougan
27 Jan 2012, 5:17 PM
So it is being masked, but just with no loading indicator or message?

This is so weird.

bweiler
27 Jan 2012, 5:46 PM
Yes. I'm getting a background mask on the list, but no spinner.

I'm sure I did something somewhere else in my code that is causing this. I'll keep looking and post a more specific question when I make more progress.

Thanks for your help

rdougan
27 Jan 2012, 9:37 PM
Good luck.

bweiler
30 Jan 2012, 10:20 AM
FYI, the loading mask spinner is disabled in PR4.

plinyar
12 Jul 2012, 2:26 AM
Second time when store is started (re)loading, loadingText in code

var loadingText = this.getLoadingText();

comes as "null" (not undefined). :(

Where we only touch it is:


Ext.define('SM.view.ProductList', {


extend: 'Ext.dataview.List',

xtype: 'productlist',


config: {
loadingText: 'Загрузка...',

plinyar
12 Jul 2012, 2:42 AM
Gentlemen, I found the sources - the "Ext.plugin.ListPaging" is the reason. It even has special method disableDataViewMask for exactly nullifying the displaying text.
So, likely I will make a workaround - re-set the displaying text before reloading the store