- 浏览: 196281 次
- 性别:
- 来自: 长沙
文章分类
最新评论
-
在世界的中心呼喚愛:
思路很好
连连看全局消除算法 -
tianaozhu:
请问,我修改了词库和源文件怎么就不好用了, 我源文件是: My ...
自己动手开发翻译软件(Java版) -
Arlrn:
博主你好,最近在学习排序算法,看了你的博客,你的直接插入排序, ...
各种排序算法的实现及其比较 -
sharong:
有一个明显错误,很显然冒泡排序的时间复杂度是O(n^2)
各种排序算法的实现及其比较 -
julydave:
希尔排序不太对吧。。
各种排序算法的实现及其比较
用XML来作为tree的数据源
所有文件都上传了
// // Extend the XmlTreeLoader to set some custom TreeNode attributes specific to our application: // Ext.app.BookLoader = Ext.extend(Ext.ux.tree.XmlTreeLoader, { //XmlTreeLoader是ux/XmlTreeLoader.js里面定义的类,可以直接拿去用 /* * processAttributes:Template method intended to be overridden by subclasses that need to provide * custom attribute processing prior to the creation of each TreeNode. This method * will be passed a config object containing existing TreeNode attribute name/value * pairs which can be modified as needed directly (no need to return the object). */ processAttributes : function(attr){ if(attr.first){ // is it an author node? //author node指的是根结点的了结点,本例中,第二层结点都是作者author,第三层都是作者写的书,具体看下面附上的xml文档内容 // 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; //first和last都是author的属性 // 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' }), listeners: { 'render': function(tp){ //在 render 事件中给 treePanel 加上 selectionchange 事件 tp.getSelectionModel().on('selectionchange', function(tree, node){ var el = Ext.getCmp('details-panel').body; //details-panel其实是一个div,在下面定义, 这边打算“重写”这个div里面的内容 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 }] }); });
其中涉及到margins 和 cmargins,区别如下:
cmargins : Object //页边空白
An object containing margins to apply to the region's collapsed element in the format {left: (left margin), top: (top margin), right: (right margin), bottom: (bottom margin)}
margins : Object //组件间的相对距离
An object containing margins to apply to the region in the format {left: (left margin), top: (top margin), right: (right margin), bottom: (bottom margin)}
附:xml-tree-data.xml
<?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>
发表评论
-
Ext js面向对象的特性
2011-05-11 11:06 10191、支持命名空间(Java里用的是包的概念) Ex ... -
Ext 2.x中,关于combobox的取值问题
2011-02-15 19:47 1777Ext中,关于combobox的取 ... -
Ext常用的知识点(三)--combobox和xml的绑定
2011-02-09 11:47 1068直接看代码,所有需要注意的地方都标在代码后面了 Ext ... -
Ext常用的知识点(二)--panel和window
2011-02-09 01:16 15481、Panel 很容易就可以做写出一个panel v ... -
Ext常用的知识点(一)--弹出消息
2011-02-08 21:38 1390首先,要写Extjs,建议大家用一个工具spket。 ... -
Extjs复习笔记(二十)-- tree和grid结合
2010-11-07 12:20 1609让tree和grid结合起来 相关内容之前大都讲过,这里就不 ... -
Extjs复习笔记(十八)-- TreePanel
2010-11-07 11:09 1311Grid这一块暂时就讲到这。这一节开始就是tree的相关内容了 ... -
Extjs复习笔记(十七)-- 给grid里面的内容分组
2010-11-07 03:11 2007给grid里面的内容分组。 Ext.onReady(fun ... -
Extjs复习笔记(十六)-- 可编辑的grid
2010-11-07 02:43 1854可编辑的grid。 可以响应数据加载完时的事件。。。 可以 ... -
Extjs复习笔记(十五)-- JsonReader
2010-11-07 01:54 2714使用JsonReader来创建grid中的store (exa ... -
Extjs复习笔记(十四)-- XmlReader
2010-11-05 13:48 2381读取XML文件来构造grid 先了解一个函数:Ext.dat ... -
Extjs复习笔记(十三)-- GridPanel
2010-11-05 03:11 1691这一节开始,复习grid,博大精深呀! 拿官网的例子来 ... -
Extjs复习笔记(十二)--form验证
2010-11-04 23:37 1431验证。。。 1、不允许 ... -
Extjs复习笔记(十一)--换肤
2010-11-04 21:48 1303换肤功能 首先写一个 ... -
Extjs复习笔记(十)-- 网页主框架
2010-11-04 14:58 1048主界面的雏形: <!DOCTYPE html ... -
Extjs复习笔记(九)-- 加载等待
2010-11-04 13:29 2129登陆时的加载状态: <style type=&qu ... -
Extjs复习笔记(八)--登陆框
2010-11-03 02:33 1779之前有一篇博客展示了一个图书管理系统,接下来的几篇博客将会解析 ... -
Ext图书管理系统
2010-10-31 10:17 1898其实这一篇日志写很久了,由于近期项目演示的需要,我把它转到这边 ... -
Extjs复习笔记(七)-- ComboBox的添加、修改
2010-10-31 02:09 2601ComboBox的测试,有几个方法没写完整,有待之后解决。。。 ... -
Extjs复习笔记(六)--完整的浮动窗口
2010-10-30 03:30 3346前面搞了这么久的基础,下面该来做这个界面了: 这是一个浮动窗 ...
相关推荐
在"Extjs复习笔记(二十)-- tree和grid结合"这篇博文中,博主探讨了如何在EXTJS中实现树形视图(Tree)与网格视图(Grid)的融合。 Tree组件在EXTJS中通常用于显示具有层级关系的数据,例如文件系统、组织架构等。...
在本篇ExtJS复习笔记中,我们聚焦于TreePanel组件,它是ExtJS库中的一个核心组件,用于构建可扩展的树形结构数据视图。TreePanel不仅提供了展示层级关系的数据模型,还支持交互操作,如节点的选择、展开与折叠等。在...
在“Extjs复习笔记(十五)-- JsonReader”这篇博文中,博主探讨了ExtJS中的JsonReader,这是数据绑定和JSON数据解析的关键部分。 JsonReader是ExtJS数据包(Ext.data)的一部分,用于从服务器获取JSON格式的数据,...
在EXTJS框架中,换肤是一项重要的功能,它允许开发者根据用户需求或品牌风格改变应用程序的外观和感觉。本文将深入探讨EXTJS的换肤机制,以及如何利用提供的主题CSS文件实现这一特性。 EXTJS是一个强大的JavaScript...
- `proxy`:定义数据源,通常设置为`ajax`或`rest`,并配置URL以连接到后端API。 - `api`:定义CRUD操作的URL,如`read`用于获取数据。 - `remoteSort`和`remoteFilter`:如果后端支持排序和过滤,应开启这些选项...
NULL 博文链接:https://lucky16.iteye.com/blog/1490278
本篇复习笔记将聚焦于EXTJS Grid中的一个重要特性——内容分组,帮助你深入理解如何实现这一功能。 内容分组在EXTJS Grid中允许你将数据按照特定字段进行分类,这样可以更清晰地组织和展示数据。这在处理大量数据时...
Extjs4.0学习笔记,以下是部分介绍: xtjs4,创建Ext组件有了新的方式,就是Ext.create(....),而且可以使用动态加载JS的方式来加快组件的渲染,我们再也不必一次加载已经...ExtJS4学习笔记(十)---ExtJS4图片验证码的实现
官方最新版本Extjs6.2版本sdk,创建新项目的时候需要用, 全面的核心框架,具有最新的Javascript标准支持 新的漂亮组件和主题,以创建漂亮的企业应用程序 现代工具链,用于构建优化,高性能,通用的应用程序 用于可视...
Extjs6.2 生成的admin-dashboard官方模板
4. **数据绑定**:阐述ExtJS的数据模型(Store)和数据显示组件(Grid、Tree)之间的数据绑定机制,包括XML、JSON数据源的加载。 5. **表单元素**:深入探讨表单(Form)的创建,包括各种表单字段(TextField、...
首先,`editable-column-tree`组件是ExtJS中的一种特殊类型的树形视图,它允许用户直接在树节点的列中编辑数据。这种功能在需要对树形结构的数据进行实时修改的场景下非常实用,例如在组织架构管理、文件系统操作...
ExtJS4学习笔记(九)---ExtJS4 EditGrid(可编辑的Grid) ExtJS4学习笔记(二)---HBox的使用 ExtJS4学习笔记(五)---Grid分页 ExtJS4学习笔记(八)---Grid多选 全选 ExtJS4学习笔记(六)---多表头Grid ExtJS4学习笔记(十)--...
"extjs-theme-bootstrap-master.zip" 文件很可能是ExtJS的一个主题包,它集成了Bootstrap的样式,使得ExtJS组件能够呈现出Bootstrap的经典外观。 在深入讲解这个主题之前,让我们先了解一下基础概念: 1. **ExtJS*...
一个extjs的OA项目 extjs-OA extjs-oaextjs-OA extjs-oa
这个"extjs-3.0-all-src"文件是ExtJS 3.0的完整源代码包,对于开发者来说,深入理解其内部机制和进行自定义扩展非常有价值。让我们详细探讨一下这个框架及其相关知识点。 1. **ExtJS框架概述**: ExtJS 是由Sencha...
ext基本的控件例子ext基本的控件例子ext基本的控件例子ext基本的控件例子
语言程序设计资料:ExtJs学习笔记-2积分.doc
ExtJS 4.2 component - Field-Money