国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 語(yǔ)言 > JavaScript > 正文

ExtJs 3.1 XmlTreeLoader Example Error

2024-05-06 14:11:36
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

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

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

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

正文

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

   2.  注意標(biāo)紅新增代碼",requestMethod: 'GET'"!!
代碼如下:
/*!
* 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',

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表

圖片精選

主站蜘蛛池模板: 攀枝花市| 宜川县| 苏尼特右旗| 宜黄县| 五台县| 玉树县| 留坝县| 阿拉善左旗| 竹北市| 来安县| 罗田县| 临湘市| 临高县| 延津县| 额敏县| 海宁市| 南郑县| 蚌埠市| 桓仁| 龙海市| 昌吉市| 浦县| 双鸭山市| 汉阴县| 元朗区| 云林县| 辽中县| 瑞金市| 永春县| 祁门县| 西藏| 丘北县| 永平县| 弋阳县| 延边| 仪征市| 广平县| 阳原县| 嵊州市| 襄城县| 北流市|