View Full Version : A few questions regarding dataUrl

10 Nov 2009, 5:53 PM
1. Where in the Ext JS 3.0 API can I find the details on the 'dataUrl'
2. When does the dataUrl get called and how is it being called or know when to call the cfm file?
3. Is it some AJAX call on the backend?

In the api under tree treePanel dataUrl is mentioned only in an example code but dataUrl does not get listed anywhere else.

Can someone explain this basic attribute

Going by an example

panel1 = new Ext.Panel({
title: 'Users',
items: [{
xtype: 'treepanel',
id: 'inbox-tree',
autoScroll: true,
animate: true,
enableDD: true,
containerScroll: true,
border: false,
dataUrl: 'get-users.cfm',
root: {
nodeType: 'async',
text: 'UserList',
draggable: false,
id: 'userList'

10 Nov 2009, 7:12 PM
Thats one of those fuzzy spots where the documentation generator has trouble keeping track.

Take a look at the loader config. When no loader is specified, the default loader is used, which grabs the value from the dataUrl specified in the TreePanel and uses it to initialize a loader. Next, take a look at the docs for Ext.tree.TreeLoader.

And yes, it is an AJAX call that is made when tree nodes are expanded. Sample response data is shown in the docs for TreeLoader.

16 Dec 2009, 1:59 PM
Does dataURL require an http URL? I am testing without the use of an app server at the moment. If I put the JSON data inline under the root property, I can see the text but if I move it to JSON and rely on the loader, the data is not read in. Maybe I need to put the full file://.... path?

16 Dec 2009, 6:12 PM
I never got to the tree module, but with other ajax calls I have going on with the datastores, you do not have to specify the full path for things in your directory path.
Example. In case your wondering the alerts.cfm is a coldfusion file with an attribute of action being passed over the call as well.

alertDataStore = new Ext.data.Store({
url: 'alerts.cfm?action=getAlerts',
reader: new Ext.data.ArrayReader(
root: 'DATA',
{name: 'ALERTID', type: 'int'},
{name: 'TILE', type: 'string'},
{name: 'DESCRIPTION', type: 'string'}
) // reader
}); // alertDataStore

17 Dec 2009, 6:18 AM
Yeah, the JSON file is in my directory path but the data isn't read in. I don't have to put the full path to it either if it's being read from a webserver. In my case I am testing the code outside my environment due to performance reasons. I guess I'm going to have to keep it inline. That's fine. I know I can break it out when I move it to my environment.