一区二区久久-一区二区三区www-一区二区三区久久-一区二区三区久久精品-麻豆国产一区二区在线观看-麻豆国产视频

ExtJs 3.1 XmlTreeLoader Example Error

前言
  關(guān)鍵字:ExtJs 3.1 XmlTreeLoader Example Error,XmlTreeLoader 錯(cuò)誤,TreePanel Error

  ExtJs 3.1的XmlTreeLoader例子折騰了我近一個(gè)下午加晚上,官方的例子沒有問題,可以加載xml的數(shù)據(jù),本地IIS死活不行,也不報(bào)錯(cuò),直接查看官方的代碼也是一模一樣的,今早意外給讓我搜到了,不是在官方,而是在貌似一個(gè)韓國的博客里面找到的,致敬一下,本文且做其簡單中文"譯"本。

原文
  http://Javarush.com/entry/ExtJS-XmlTreeLoader-Error 

正文

   1.  代碼位置:Ext3.1/examples/tree/xml-tree-loader.js

   2.  注意標(biāo)紅新增代碼",requestMethod: 'GET'"!!
復(fù)制代碼 代碼如下:
/*!
* Ext JS Library 3.1.0
* Copyright(c) 2006-2009 Ext JS, LLC
* licensing@extjs.com
* http://www.extjs.com/license
*/

//
// Extend the XmlTreeLoader to set some custom TreeNode attributes specific to our application:
//
Ext.app.BookLoader = Ext.extend(Ext.ux.tree.XmlTreeLoader, {
processAttributes : function(attr){
if(attr.first){ // is it an author node?

// Set the node text that will show in the tree since our raw data does not include a text attribute:
attr.text = attr.first + ' ' + attr.last;

// Author icon, using the gender flag to choose a specific icon:
attr.iconCls = 'author-' + attr.gender;

// Override these values for our folder nodes because we are loading all data at once. If we were
// loading each node asynchronously (the default) we would not want to do this:
attr.loaded = true;
attr.expanded = true;
}
else if(attr.title){ // is it a book node?

// Set the node text that will show in the tree since our raw data does not include a text attribute:
attr.text = attr.title + ' (' + attr.published + ')';

// Book icon:
attr.iconCls = 'book';

// Tell the tree this is a leaf node. This could also be passed as an attribute in the original XML,
// but this example demonstrates that you can control this even when you cannot dictate the format of
// the incoming source XML:
attr.leaf = true;
}
}
});

Ext.onReady(function(){

var detailsText = '<i>Select a book to see more information...</i>';

var tpl = new Ext.Template(
'<h2 class="title">{title}</h2>',
'<p><b>Published</b>: {published}</p>',
'<p><b>Synopsis</b>: {innerText}</p>',
'<p><a href="{url}" target="_blank">Purchase from Amazon</a></p>'
);
tpl.compile();

new Ext.Panel({
title: 'Reading List',
renderTo: 'tree',
layout: 'border',
width: 500,
height: 500,
items: [{
xtype: 'treepanel',
id: 'tree-panel',
region: 'center',
margins: '2 2 0 2',
autoScroll: true,
rootVisible: false,
root: new Ext.tree.AsyncTreeNode(),

// Our custom TreeLoader:
loader: new Ext.app.BookLoader({
dataUrl:'xml-tree-data.xml'
,requestMethod: 'GET'
}),

listeners: {
'render': function(tp){
tp.getSelectionModel().on('selectionchange', function(tree, node){
var el = Ext.getCmp('details-panel').body;
if(node && node.leaf){
tpl.overwrite(el, node.attributes);
}else{
el.update(detailsText);
}
})
}
}
},{
region: 'south',
title: 'Book Details',
id: 'details-panel',
autoScroll: true,
collapsible: true,
split: true,
margins: '0 2 2 2',
cmargins: '2 2 2 2',
height: 220,
html: detailsText
}]
});
});

結(jié)束語

  不要放棄和接受一次失敗的搜索,不斷的嘗試改變搜索關(guān)鍵字,哪怕是用詞霸翻成英文也得努力去試試,看不懂不要緊,看懂代碼就行,代碼無國界: )

JavaScript技術(shù)ExtJs 3.1 XmlTreeLoader Example Error,轉(zhuǎn)載需保留來源!

鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請第一時(shí)間聯(lián)系我們修改或刪除,多謝。

主站蜘蛛池模板: 青青草伊人久久 | 福利91| 亚洲第一免费视频 | 国产香蕉久久精品综合网 | 加勒比综合在线 | 微拍秒拍99福利精品小视频 | 女的毛片毛片毛毛片毛毛毛毛片 | 日韩中文字幕在线免费观看 | 色老板最新地址 | 亚洲精品色 | 婷婷在线免费观看 | 四虎永久免费地址在线观看 | 国产一区二区视频在线播放 | 久久国产精品只做精品 | 高清一区高清二区视频 | 欧美zoosex| 国产精品_国产精品_国产精品 | 激情五月综合综合久久69 | 日本www色视频成人免费 | 亚洲精品国产成人 | 国内不卡一二三四区 | 在线观看国产一区二区三区99 | 婷婷亚洲天堂 | 亚洲一区二区三区夜色 | 四虎永久免费最新在线 | 国产精品亚洲片在线花蝴蝶 | 欧美另类videosbestsex高清 | 中文字幕在线精品视频万部 | 亚洲一级毛片免费看 | 欧美 亚洲 丝袜 清纯 中文 | 99久久久久国产精品免费 | 亚洲九九视频 | 国产呦精品一区二区三区网站 | 伊人网在线视频 | 国产99在线观看 | 4338×亚洲全国最大色成网站 | 热99精品视频 | 国产区成人综合色在线 | 免费在线小视频 | 国产激情视频网站 | 最新精品在线视频 |