- 浏览: 197242 次
- 性别:
- 来自: 长沙
文章分类
最新评论
-
在世界的中心呼喚愛:
思路很好
连连看全局消除算法 -
tianaozhu:
请问,我修改了词库和源文件怎么就不好用了, 我源文件是: My ...
自己动手开发翻译软件(Java版) -
Arlrn:
博主你好,最近在学习排序算法,看了你的博客,你的直接插入排序, ...
各种排序算法的实现及其比较 -
sharong:
有一个明显错误,很显然冒泡排序的时间复杂度是O(n^2)
各种排序算法的实现及其比较 -
julydave:
希尔排序不太对吧。。
各种排序算法的实现及其比较
使用JsonReader来创建grid中的store (examples/grid/binding)
下面程序中,绿色的注释大都是API中的解释,有助于理解,我把它直接加上程序中了
Ext.onReady(function(){ var store = new Ext.data.Store({ remoteSort: true, //用下面的代理proxy默认的数据顺序来排序,详细: /*true if sorting is to be handled by requesting the Proxy to provide a refreshed version of the data object in sorted order, as opposed to sorting the Record cache in place (defaults to false). If remoteSort is true, then clicking on a Grid Column's header causes the current page to be requested from the server appending the following two parameters to the params: sort : String The name (as specified in the Record's Field definition) of the field to sort on. dir : String The direction of the sort, 'ASC' or 'DESC' (case-sensitive).*/ baseParams: {lightWeight:true,ext: 'js'}, //要做为参数传给服务器 /*baseParams:An object containing properties which are to be sent as parameters for every HTTP request. Parameters are encoded as standard HTTP parameters using Ext.urlEncode. Note: baseParams may be superseded by any params specified in a load request, see load for more details. This property may be modified after creation using the setBaseParam method.*/ sortInfo: {field:'lastpost', direction:'DESC'}, //排序用的一些参数 /*sortInfo:A config object to specify the sort order in the request of a Store's load operation. Note that for local sorting, the direction property is case-sensitive. See also remoteSort and paramNames. For example: sortInfo: { field: 'fieldName', direction: 'ASC' // or 'DESC' (case sensitive for local sorting) }*/ autoLoad: {params:{start:0, limit:500}}, /*autoLoad:If data is not specified, and if autoLoad is true or an Object, this store's load method is automatically called after creation. If the value of autoLoad is an Object, this Object will be passed to the store's load method.*/ proxy: new Ext.data.ScriptTagProxy({ //The DataProxy object which provides access to a data object. url: 'http://extjs.com/forum/topics-browse-remote.php' }), /*ScriptTagProxy:An implementation of Ext.data.DataProxy that reads a data object from a URL which may be in a domain other than the originating domain of the running page. Note that if you are retrieving data from a page that is in a domain that is NOT the same as the originating domain of the running page, you must use this class, rather than HttpProxy. The content passed back from a server resource requested by a ScriptTagProxy must be executable JavaScript source code because it is used as the source inside a <script> tag. In order for the browser to process the returned data, the server must wrap the data object with a call to a callback function, the name of which is passed as a parameter by the ScriptTagProxy. Below is a Java example for a servlet which returns data for either a ScriptTagProxy, or an HttpProxy depending on whether the callback name was passed: boolean scriptTag = false; String cb = request.getParameter("callback"); if (cb != null) { scriptTag = true; response.setContentType("text/javascript"); } else { response.setContentType("application/x-json"); } Writer out = response.getWriter(); if (scriptTag) { out.write(cb + "("); } out.print(dataBlock.toJsonString()); if (scriptTag) { out.write(");"); } Below is a PHP example to do the same thing: $callback = $_REQUEST['callback']; // Create the output object. $output = array('a' => 'Apple', 'b' => 'Banana'); //start output if ($callback) { header('Content-Type: text/javascript'); echo $callback . '(' . json_encode($output) . ');'; } else { header('Content-Type: application/x-json'); echo json_encode($output); } Below is the ASP.Net code to do the same thing: String jsonString = "{success: true}"; String cb = Request.Params.Get("callback"); String responseString = ""; if (!String.IsNullOrEmpty(cb)) { responseString = cb + "(" + jsonString + ")"; } else { responseString = jsonString; } Response.Write(responseString);*/ reader: new Ext.data.JsonReader({ root: 'topics', //必写项,对应json数据中的一个array,数组 totalProperty: 'totalCount', /*totalProperty:Name of the property from which to retrieve the total number of records in the dataset. This is only needed if the whole dataset is not passed in one go, but is being paged from the remote server. Defaults to total.*/ idProperty: 'threadid', //主键名 fields: [ //要取出的各个字段 'title', 'forumtitle', 'forumid', 'author', {name: 'replycount', type: 'int'}, {name: 'lastpost', mapping: 'lastpost', type: 'date', dateFormat: 'timestamp'}, 'lastposter', 'excerpt' ] }) }); var grid = new Ext.grid.GridPanel({ renderTo: 'topic-grid', width:700, height:500, frame:true, title:'ExtJS.com - Browse Forums', trackMouseOver:false,//True to highlight rows when the mouse is over. Default is true for GridPanel, but false for EditorGridPanel. autoExpandColumn: 'topic', /*autoExpandColumn:The id of a column in this grid that should expand to fill unused space. This value specified here can not be 0. Note: If the Grid's view is configured with forceFit=true the autoExpandColumn is ignored. See Ext.grid.Column.width for additional details.*/ store: store, columns: [new Ext.grid.RowNumberer({width: 30}),//行号 { id: 'topic', header: "Topic", dataIndex: 'title', //json数据中对应的数据的索引 width: 420, renderer: renderTopic, //这是非常重要的一个属性,renderTopic是下面的一个函数,用来格式化本列,从下面的函数可以看出,本列显示的是一些链接和几个数据的组合 sortable:true },{ header: "Replies", dataIndex: 'replycount', width: 70, align: 'right', //这个属性也很重要,用来对齐数据 sortable:true },{ id: 'last', header: "Last Post", dataIndex: 'lastpost', width: 150, renderer: renderLast, //renderLast是下面的一个函数 sortable:true }], bbar: new Ext.PagingToolbar({ //bbar就是grid最下方的工具条,PagingToolbar是用来分页的一个实用的工具,下面详细解释 store: store, pageSize:500, displayInfo:true //true to display the displayMsg (defaults to false) }), /*PagingToolbar:As the amount of records increases, the time required for the browser to render them increases. Paging is used to reduce the amount of data exchanged with the client. Note: if there are more records/rows than can be viewed in the available screen area, vertical scrollbars will be added. Paging is typically handled on the server side (see exception below). The client sends parameters to the server side, which the server needs to interpret and then respond with the approprate data. Ext.PagingToolbar is a specialized toolbar that is bound to a Ext.data.Store and provides automatic paging control. This Component loads blocks of data into the store by passing paramNames used for paging criteria. PagingToolbar is typically used as one of the Grid's toolbars: Ext.QuickTips.init(); // to display button quicktips var myStore = new Ext.data.Store({ reader: new Ext.data.JsonReader({ totalProperty: 'results', ... }), ... }); var myPageSize = 25; // server script should only send back 25 items at a time var grid = new Ext.grid.GridPanel({ ... store: myStore, bbar: new Ext.PagingToolbar({ store: myStore, // grid and PagingToolbar using same store displayInfo: true, pageSize: myPageSize, prependButtons: true, items: [ 'text 1' ] }) }); To use paging, pass the paging requirements to the server when the store is first loaded. store.load({ params: { // specify params for the first page load if using paging start: 0, limit: myPageSize, // other params foo: 'bar' } }); If using store's autoLoad configuration: var myStore = new Ext.data.Store({ autoLoad: {params:{start: 0, limit: 25}}, ... }); The packet sent back from the server would have this form: { "success": true, "results": 2000, "rows": [ // *Note: this must be an Array { "id": 1, "name": "Bill", "occupation": "Gardener" }, { "id": 2, "name": "Ben", "occupation": "Horticulturalist" }, ... { "id": 25, "name": "Sue", "occupation": "Botanist" } ] } Paging with Local Data Paging can also be accomplished with local data using extensions: Ext.ux.data.PagingStore Paging Memory Proxy (examples/ux/PagingMemoryProxy.js)*/ view: new Ext.ux.grid.BufferView({ //view:The Ext.grid.GridView used by the grid. This can be set before a call to render(). ..... BufferView:是自定义的一个类,下面我把定义这个类的文件上传了。其实这个也可以到源码中的examples/ux/BufferView.js上找到 // custom row height rowHeight: 34, // render rows as they come into viewable area. scrollDelay: false }) }); // render functions function renderTopic(value, p, record){//本函数用来格式化列中数据显示的格式 return String.format(//下面的{0} {1} {2}等分别对应下面列出的数据 '<b><a href="http://extjs.com/forum/showthread.php?t={2}" target="_blank">{0}</a></b><a href="http://extjs.com/forum/forumdisplay.php?f={3}" target="_blank">{1} Forum</a>', value, record.data.forumtitle, record.id, record.data.forumid); } function renderLast(value, p, r){ return String.format('{0}<br/>by {1}', value.dateFormat('M j, Y, g:i a'), r.data['lastposter']); } });
发表评论
-
Ext js面向对象的特性
2011-05-11 11:06 10251、支持命名空间(Java里用的是包的概念) Ex ... -
Ext 2.x中,关于combobox的取值问题
2011-02-15 19:47 1781Ext中,关于combobox的取 ... -
Ext常用的知识点(三)--combobox和xml的绑定
2011-02-09 11:47 1078直接看代码,所有需要注意的地方都标在代码后面了 Ext ... -
Ext常用的知识点(二)--panel和window
2011-02-09 01:16 15521、Panel 很容易就可以做写出一个panel v ... -
Ext常用的知识点(一)--弹出消息
2011-02-08 21:38 1403首先,要写Extjs,建议大家用一个工具spket。 ... -
Extjs复习笔记(二十)-- tree和grid结合
2010-11-07 12:20 1616让tree和grid结合起来 相关内容之前大都讲过,这里就不 ... -
Extjs复习笔记(十九)-- XML作为tree的数据源
2010-11-07 11:52 2686用XML来作为tree的数据源 所有文件都上传了 ... -
Extjs复习笔记(十八)-- TreePanel
2010-11-07 11:09 1331Grid这一块暂时就讲到这。这一节开始就是tree的相关内容了 ... -
Extjs复习笔记(十七)-- 给grid里面的内容分组
2010-11-07 03:11 2013给grid里面的内容分组。 Ext.onReady(fun ... -
Extjs复习笔记(十六)-- 可编辑的grid
2010-11-07 02:43 1865可编辑的grid。 可以响应数据加载完时的事件。。。 可以 ... -
Extjs复习笔记(十四)-- XmlReader
2010-11-05 13:48 2389读取XML文件来构造grid 先了解一个函数:Ext.dat ... -
Extjs复习笔记(十三)-- GridPanel
2010-11-05 03:11 1705这一节开始,复习grid,博大精深呀! 拿官网的例子来 ... -
Extjs复习笔记(十二)--form验证
2010-11-04 23:37 1455验证。。。 1、不允许 ... -
Extjs复习笔记(十一)--换肤
2010-11-04 21:48 1310换肤功能 首先写一个 ... -
Extjs复习笔记(十)-- 网页主框架
2010-11-04 14:58 1054主界面的雏形: <!DOCTYPE html ... -
Extjs复习笔记(九)-- 加载等待
2010-11-04 13:29 2136登陆时的加载状态: <style type=&qu ... -
Extjs复习笔记(八)--登陆框
2010-11-03 02:33 1787之前有一篇博客展示了一个图书管理系统,接下来的几篇博客将会解析 ... -
Ext图书管理系统
2010-10-31 10:17 1908其实这一篇日志写很久了,由于近期项目演示的需要,我把它转到这边 ... -
Extjs复习笔记(七)-- ComboBox的添加、修改
2010-10-31 02:09 2604ComboBox的测试,有几个方法没写完整,有待之后解决。。。 ... -
Extjs复习笔记(六)--完整的浮动窗口
2010-10-30 03:30 3356前面搞了这么久的基础,下面该来做这个界面了: 这是一个浮动窗 ...
相关推荐
在"Extjs复习笔记(二十)-- tree和grid结合"这篇博文中,博主探讨了如何在EXTJS中实现树形视图(Tree)与网格视图(Grid)的融合。 Tree组件在EXTJS中通常用于显示具有层级关系的数据,例如文件系统、组织架构等。...
在本篇ExtJS复习笔记中,我们聚焦于TreePanel组件,它是ExtJS库中的一个核心组件,用于构建可扩展的树形结构数据视图。TreePanel不仅提供了展示层级关系的数据模型,还支持交互操作,如节点的选择、展开与折叠等。在...
在EXTJS框架中,换肤是一项重要的功能,它允许开发者根据用户需求或品牌风格改变应用程序的外观和感觉。本文将深入探讨EXTJS的换肤机制,以及如何利用提供的主题CSS文件实现这一特性。 EXTJS是一个强大的JavaScript...
NULL 博文链接:https://lucky16.iteye.com/blog/1490278
本篇复习笔记将聚焦于EXTJS Grid中的一个重要特性——内容分组,帮助你深入理解如何实现这一功能。 内容分组在EXTJS Grid中允许你将数据按照特定字段进行分类,这样可以更清晰地组织和展示数据。这在处理大量数据时...
Extjs6.2 生成的admin-dashboard官方模板
Extjs4.0学习笔记,以下是部分介绍: xtjs4,创建Ext组件有了新的方式,就是Ext.create(....),而且可以使用动态加载JS的方式来加快组件的渲染,我们再也不必一次加载已经...ExtJS4学习笔记(十)---ExtJS4图片验证码的实现
这篇“ExtJS笔记——Grid实现后台分页”探讨了如何在ExtJS的Grid组件中实现高效的后台分页功能。 后台分页是一种常见的数据处理策略,特别是在大数据量的情况下,它将数据分批加载,避免一次性加载所有记录导致的...
官方最新版本Extjs6.2版本sdk,创建新项目的时候需要用, 全面的核心框架,具有最新的Javascript标准支持 新的漂亮组件和主题,以创建漂亮的企业应用程序 现代工具链,用于构建优化,高性能,通用的应用程序 用于可视...
"extjs-theme-bootstrap-master.zip" 文件很可能是ExtJS的一个主题包,它集成了Bootstrap的样式,使得ExtJS组件能够呈现出Bootstrap的经典外观。 在深入讲解这个主题之前,让我们先了解一下基础概念: 1. **ExtJS*...
ExtJS 是一个强大的JavaScript库,专门用于构建富客户端Web应用程序。在标题"extjs2----关于extjs 的使用,操作"中,我们可以看出这是一份关于ExtJS 2.0版本的使用指南,主要涵盖了其基本操作和应用。描述中提到内容...
一个extjs的OA项目 extjs-OA extjs-oaextjs-OA extjs-oa
ext基本的控件例子ext基本的控件例子ext基本的控件例子ext基本的控件例子
ExtJS4学习笔记(十五)---Ext.data.Model ExtJS4学习笔记(十六)---Combobox三级联动 ExtJS4学习笔记(十四)--- ComponentQuery ExtJS4学习笔记(四)---Grid的使用 Extjs4开发笔记(三)——菜单的实现 Extjs4开发笔记(二)...
ExtJS 4.2 component - Field-Money
ExtJS 是一个流行的JavaScript库,主要用于构建富客户端的Web应用程序。这个实例——"嗖嗖嗖",似乎是一个基于ExtJS的项目,但具体的功能或用途并未在标题和描述中明确指出。不过,我们可以根据提供的文件名来推测...
这个"extjs-3.0-all-src"文件是ExtJS 3.0的完整源代码包,对于开发者来说,深入理解其内部机制和进行自定义扩展非常有价值。让我们详细探讨一下这个框架及其相关知识点。 1. **ExtJS框架概述**: ExtJS 是由Sencha...
标题“ExtJS Oracle分页---Json转换”涉及的是在Web应用程序开发中,使用ExtJS框架与Oracle数据库进行分页数据交互,并通过Json格式进行数据转换的技术。以下是对这个主题的详细解释: ExtJS是一个强大的JavaScript...
语言程序设计资料:ExtJs学习笔记-2积分.doc