Ext


Go Back   Ext JS Forums > Ext JS Community Forums (2.0) > Ext 2.x: Help

Reply
 
Thread Tools
  #1  
Old 02-27-2009, 05:55 PM
joshuabco's Avatar
joshuabco joshuabco is offline
Ext User
 
Join Date: Aug 2008
Location: Bucaramanga, Santander, Colombia
Posts: 33
joshuabco is on a distinguished road
Send a message via MSN to joshuabco
Question [SOLVED] XmlTreeLoader sp is undefined

Hi, I have this problem with XmlTreeLoader with ext js 2.2.1 ... the firebug error is

sp is undefined
[IMG]chrome://firebug/content/blank.gif[/IMG]Ext={version:"2.2.1"};window["undefined"...strain(i.left,i.right);return this}})();

and the code is :



Ext
.app.BookLoader Ext.extend(Ext.ux.XmlTreeLoader, {
    
processAttributes : function(attr){
        if(
attr.first){ 
            
attr.text attr.first ' ' attr.last;
            
attr.iconCls 'author-' attr.gender;
            
attr.loaded true;
        }
        else if(
attr.title){
            
attr.text attr.title ' (' attr.published ')';
            
attr.iconCls 'book';
            
attr.leaf true;
        }
    }
});
Ext.onReady(function(){
   var 
layoutPanel = new Ext.Panel({
                                    
layout:'border',
                                    
renderTo'div_layout',
                                    
defaults: {
                                        
collapsibletrue,
                                        
splittrue,
                                        
bodyStyle'padding:15px'
                                    
},
                                    
items: [generarArbolDocumentos(),{
                                        
title'Descripcion del concepto',
                                        
collapsiblefalse,
                                        
region:'center',
                                        
margins'5 0 0 0',
                                        
contentEl'div_contenidos'
                                    
}]
                                });
        
viewport = new Ext.Viewport({
        
autoshow:true,
        
layout'fit',
        
defaults: {
            
activeItem0
        
},
        
itemslayoutPanel
    
});
    
viewport.doLayout();
});
function 
generarArbolDocumentos(){
    var 
panel = new Ext.Panel({
                                
title'Arbol de conceptos',
                                
region:'west',
                                
margins'5 0 0 0',
                                
cmargins'5 5 0 0',
                                
renderTo'div_arbol',
                                
width175,
                                
autoScrolltrue,
                                
rootVisiblefalse,
                                
root: new Ext.tree.AsyncTreeNode(),
                                
loader: new Ext.app.BookLoader({
                                    
dataUrl:'visConceptosAjax.jsp?opcion=1'
                                
}),
                                
listeners: {
                                    
'render': function(tp){
                                        
tp.getSelectionModel().on('selectionchange', function(treenode){
                                            var 
el Ext.getCmp('details-panel').body;
                                            if(
node.leaf){
                                                
tpl.overwrite(elnode.attributes);
                                            }else{
                                                
el.update(detailsText);
                                            }
                                        })
                                    }
                                }
    });
    return 
panel;

I just want to load a XML data from a jsp page with parameter "opcion=1" there is the answer:



<?xml version="1.0" encoding="ISO-8859-1"?>
<authors>
    <author first="Fyodor" last="Dostoevsky" gender="m">
        <book title="Crime and Punishment" published="1866" url="http://www.amazon.com/Crime-Punishment-Fyodor-Dostoevsky/dp/0679734503/">
            Raskolnikov, a destitute and desperate former student, commits a random murder without remorse or regret, imagining himself to be a great man far above moral law. But as he embarks on a dangerous cat-and-mouse game with a suspicious police investigator, his own conscience begins to torment him.
        </book>
        <book title="The Brothers Karamazov" published="1879" url="http://www.amazon.com/Brothers-Karamazov-Fyodor-Dostoevsky/dp/0374528373/">
            Driven by intense, uncontrollable emotions of rage and revenge, the Karamozov brothers become involved in the brutal murder of their despicable father. It is a love-hate struggle with profound psychological and spiritual implications.
        </book>
    </author>
    <author first="Stephen" last="King" gender="m">
        <book title="The Shining" published="1977" url="http://www.amazon.com/Shining-Stephen-King/dp/0743424425/">
            An alcoholic man, his wife, and his psychic son go to a large haunted hotel for the winter, where the child is threatened by supernatural and family dangers.
        </book>
        <book title="Cujo" published="1981" url="http://www.amazon.com/Cujo-Signet-Stephen-King/dp/0451161351/">
            A big, friendly dog chases a rabbit into a hidden underground cave and stirs a sleeping evil crueler than death itself. The little Maine town of Castle Rock is about to be invaded by the most hideous menace ever to savage the flesh and devour the mind.
        </book>
        <book title="IT" published="1986" url="http://www.amazon.com/Signet-Books-Stephen-King/dp/0451169514/">
            They were seven teenagers when they first stumbled upon the horror. Now they were grown-up men and women who had gone out into the big world to gain success and happiness. But none of them could withstand the force that drew them back to Derry, Maine to face the nightmare without an end, and the evil without a name.
        </book>
    </author>
    <author first="J.K." last="Rowling" gender="f">
        <book title="Harry Potter and the Sorcerer's Stone" published="1997" url="http://www.amazon.com/Harry-Potter-Sorcerers-Stone-Book/dp/043936213X/">
            All Harry Potter knows is a miserable life with the Dursleys, his horrible aunt and uncle, and their abominable son, Dudley. But all that is about to change when a mysterious letter arrives by owl messenger: a letter with an invitation to a wonderful place he never dreamed existed.
        </book>
        <book title="Harry Potter and the Chamber of Secrets" published="1998" url="http://www.amazon.com/Harry-Potter-Chamber-Secrets-Book/dp/0439064864/">
            Someone - or something - starts turning Hogwarts students to stone. Could it be Draco Malfoy, a more poisonous rival than ever? Could it possibly be Hagrid, whose mysterious past is finally told? Or could it be the one everyone at Hogwarts most suspects... Harry Potter himself!
        </book>
        <book title="Harry Potter and the Prisoner of Azkaban" published="1999" url="http://www.amazon.com/Harry-Potter-Prisoner-Azkaban-Book/dp/043965548X/">
            For Twelve long years, the dread fortress of Azkaban held an infamous prisoner named Sirius Black. Now he has escaped, and the Azkaban guards heard Black muttering in his sleep, "He's at Hogwarts..." Harry Potter isn't safe, not even within the walls of his magical school. Because on top of it all, there may well be a traitor in their midst.
        </book>
    </author>
</authors>
As we can see is like the example, just xml loading from a jsp not a file... I'ts posible? or where is my error?

thanks in advance.
Reply With Quote
  #2  
Old 02-27-2009, 07:53 PM
mankz's Avatar
mankz mankz is offline
Ext User
 
Join Date: Nov 2007
Location: Lund, Sweden
Posts: 721
mankz is on a distinguished road
Send a message via MSN to mankz Send a message via Skype™ to mankz
Default

"sp is undefined" is what you get when try to extend an undefined value, meaning that Ext.ux.XmlTreeLoader is undefined. Have you included all files correctly in the right order etc? Ext.ux.XmlTreeLoader is not part of the standard Ext package afaik, you'll have to include XmlTreeLoader.js manually...
__________________
Why bother with subroutines when you can type fast?
Reply With Quote
  #3  
Old 02-28-2009, 09:27 AM
joshuabco's Avatar
joshuabco joshuabco is offline
Ext User
 
Join Date: Aug 2008
Location: Bucaramanga, Santander, Colombia
Posts: 33
joshuabco is on a distinguished road
Send a message via MSN to joshuabco
Default [SOLVED] XmlTreeLoader sp is undefined

yes there is a head main page



 
<head>
        <
meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <
script type="text/javascript" src="../js/ext/adapter/yui/yui-utilities.js"></script>
        <script type="text/javascript" src="../js/ext/adapter/yui/ext-yui-adapter.js"></script>
        <script type="text/javascript" src="../js/ext/ext-all-debug.js"></script>
        <script type="text/javascript" src="../js/ext/build/widgets/grid/GroupSummary.js"></script>
        <script type="text/javascript" src="../js/ext_vis_conceptos.js"></script>
        <script type="text/javascript" src="../js/ext/source/locale/ext-lang-es.js"></script>
        <script type="text/javascript" src="XmlTreeLoader.js"></script>
        <link href="../js/ext/resources/css/ext-all.css" rel="stylesheet" type="text/css" />
        <link href="../css/configStyle.css" rel="stylesheet" type="text/css" />
        <title>Visualizador de conceptos</title>
    </head> 
There is a error!!!... I'm loading XmlTreeLoader.js after load my js "ext_vis_conceptos.js" thanks very much!!!
Reply With Quote
Reply

Thread Tools

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

All times are GMT -5. The time now is 01:54 PM.

© 2006-2009 Ext, LLC
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.