PDA

View Full Version : Store debugging help



steffenk
15 Jul 2009, 2:17 AM
Hi,

i need some help how to debug a store.
In my case, with one url the store is filled after load with data.items, with another url it's empty. Now i need to know what went wrong. I think i have to debug inside Reader. What is the best practise without breakpoints in ext_all?

Animal
15 Jul 2009, 2:22 AM
You mean ext-all-debug of course.

Search for the function, set the breakpoint, run.

steffenk
15 Jul 2009, 3:10 AM
hm - as i wrote i didn't want to step over so much code in ext-all-debug. When i debug the store after load i see what is filled and what not. I can see that my fields are filled correct, but data is empty.

So i want to break it down, and want to ask how you do such debug: in a callback function, override reader or ...

Condor
15 Jul 2009, 3:14 AM
The callback function returns the most complete information (it's called for both success and failure).

If you don't want to define a callback for every store you could use class level listeners for stores (Ext 3 only).

steffenk
15 Jul 2009, 11:33 PM
Hi,

i have a further question.

when i use ext-all-debug there should be the console available with ctrl + shift + home
But it never popups. When i look at the example (which works) i see no other magic. What can be the problem? (no js error at all) Is there an alternative way to open the console?

Condor
15 Jul 2009, 11:39 PM
Ext 3.0.0 ext-all-debug.js doesn't contain src/debug.js. You'll have to include the file separately.

steffenk
15 Jul 2009, 11:42 PM
ah - thx. For what reason was it excluded?

Edit: tested and doesn't work either. I don't find the key handler calling it. Also manual call of createConsole() brings up an error. Do i miss something?

Condor
16 Jul 2009, 12:50 AM
It was excluded by accident (the current build process makes ext-all-debug and ext-all completely the same, so the build process would have to be modified).

You did include src/debug.js or examples/debug/debug.js (the second one has a bug)?

steffenk
16 Jul 2009, 1:00 AM
Hi,

i included src/debug.js as you suggested.

steffenk
16 Jul 2009, 6:17 AM
sorry for pushing again, but i'm not able to open the debug console.
When i look to the debug example, it includes own debug.js. But i don't get how it's appended to the border layout.

So how can i manually open the console, eg in a Wxt.window, any suggestions?

Condor
16 Jul 2009, 6:28 AM
The example includes the wrong debug.js (it has a bug) and it includes debug.css (while it is already included in ext-all.css).

In the example, the debug console is not appended to the border layout, it's floating over the border layout.

Does the example work for you?

The console uses z-index:101. Could it be that this is too low for your application?

steffenk
16 Jul 2009, 6:40 AM
Hi,

the example is working for me (but not the way with ctrl + shift + home) as the debug is visible from the beginning.

I tested with an empty page, only including the files, and no way to open console, that is my problem. I also don't see it in the example how it's done (but it's a different debug.js anyway)

steffenk
16 Jul 2009, 7:51 AM
hm - finally i found the way. Console is always border layout in body, and it pops up only if there is an Ext.Log call.

I got it by using a link like in the example:

<p><a href="#" onclick="Ext.log('Hello from the Ext console. This is logged using the Ext.log function.');return false;">Click for console</a></p>

but this isn't handy, eg when you want to inspect dom, so the key shortcut was removed :(

And the datastore inspector is empty although i use store(s) in my App.

and sry for complaining more, the object inspector isn't really helpful as it shows up only the names of the objects without any properties.
Is this an area where something will be done or is it just a bonus and stay as it is?

Condor
16 Jul 2009, 11:00 AM
The Ext debugger isn't used by many. All current browsers already have some way to inspect the DOM.

I you really plan on using the Ext debugger, you should probably list your complaints in a bugreport.

steffenk
16 Jul 2009, 3:03 PM
Hi Condor,

first thx for your support.

I know it won't be a FB like tool, but it's nice and should work. The specials like Data Store View makes it really interesting, and enhancement with ExtJS-specific things would make it really unique.

I created a bug report now.

Condor
16 Jul 2009, 10:57 PM
Only stores with a storeId config option can be examined on the Data Stores tab.

ps. Using a storeId will register the store with the StoreMgr. Remember that you have to unregister the store when you are done, otherwise it won't be removed from memory.

steffenk
16 Jul 2009, 11:35 PM
good hint! Maybe it should be mentioned in the docs anywhere.
Debug is not mentioned anywhere, also Ext.Log. It's not ux, so it should be in the doc too.

Extra bugreport for this? :) done, added to the one.

Stripeman
17 Jul 2009, 12:34 AM
hm - finally i found the way. Console is always border layout in body, and it pops up only if there is an Ext.Log call.

I got it by using a link like in the example:

<p><a href="#" onclick="Ext.log('Hello from the Ext console. This is logged using the Ext.log function.');return false;">Click for console</a></p>

but this isn't handy, eg when you want to inspect dom, so the key shortcut was removed :(

And the datastore inspector is empty although i use store(s) in my App.

and sry for complaining more, the object inspector isn't really helpful as it shows up only the names of the objects without any properties.
Is this an area where something will be done or is it just a bonus and stay as it is?

I like the console. Do you have any suggestions for an alternative?

steffenk
17 Jul 2009, 12:36 AM
no, alternative are the browser tools. But enhancements would be good.

Stripeman
17 Jul 2009, 1:23 AM
any recommendations how to get like the store into the Ext.log?
I tried
Ext.getCmp('south').innerHTML= Ext.log(dataStore);

but that dont work

steffenk
17 Jul 2009, 1:28 AM
as Condor mentioned: add a storeId to your store, then it will be inspectable in debug console


this.store = new Ext.data.JsonStore({
storeId: 'myStore',
idProperty: 'id',
fields: this.getFields(),

proxy: new Ext.data.ScriptTagProxy({
url: this.url
})
});

Stripeman
17 Jul 2009, 2:01 AM
Thanks Steffenk,
ah... got yas. "id' also works. Can you inspect all elements (that have an' id' argument ?

steffenk
17 Jul 2009, 2:18 AM
what do you mean?

Have a look to debug.js, it's not such big. In parseStores you'll see
var cn = Ext.StoreMgr.items;

So the store has to be added to Ext.StoreMgr. I wasn't aware that this is done with id also.

Now, as Condor also mentioned, a destroy function has to take care to remove the store later from Ext.Stormgr to get resource free.

There seems to be a bug in ObjectInspector - it only prints the value without looking to the type. So most you see [object Object] When i find some time i try to make it a tree like the HTML-Inspector.

Condor
17 Jul 2009, 3:39 AM
In really old Ext versions the StoreMgr used the 'id' of the store. Later the 'storeId' config option was added, because JsonStore used the 'id' config option both for 'storeId' and 'idProperty'.

For this reason, the 'id' property of Store is marked 'deprecated'.

Stripeman
17 Jul 2009, 3:53 AM
what do you mean?

Have a look to debug.js, it's not such big. In parseStores you'll see
var cn = Ext.StoreMgr.items;

So the store has to be added to Ext.StoreMgr. I wasn't aware that this is done with id also.

Is this not done automatically ? If not.. how am i to do that? Is it done automatially once i assing a storeId?



Now, as Condor also mentioned, a destroy function has to take care to remove the store later from Ext.Stormgr to get resource free.

That would explain why i cant view the contents of the store after the page has been built. (i think?)




When i find some time i try to make it a tree like the HTML-Inspector.
This would be awesome! I wish i knew Ext well enought to do these sort of things..


In really old Ext versions the StoreMgr used the 'id' of the store. Later the 'storeId' config option was added, because JsonStore used the 'id' config option both for 'storeId' and 'idProperty'.

For this reason, the 'id' property of Store is marked 'deprecated'.

Got yas.. Thanks Condor. I will update my code.