我的技術(shù)貼的首發(fā)地址:http://atian25.javaeye.com/

          天豬部落閣 - (ExtJS && AS3 && Java)

          專(zhuān)注于ExtJS && AS3 && Java

          導(dǎo)航

          <2008年9月>
          31123456
          78910111213
          14151617181920
          21222324252627
          2829301234
          567891011

          公告

          我的技術(shù)貼的首發(fā)地址:http://atian25.javaeye.com/

          留言簿(1)

          文章分類(lèi)(13)

          隨筆檔案(10)

          文章檔案(11)

          相冊(cè)

          閱讀排行榜

          評(píng)論排行榜

          常用鏈接

          統(tǒng)計(jì)

          FLASH

          WORK

          友情鏈接

          最新評(píng)論

          2008年9月26日 #

          ExtJS 3.0 在skpet里面的代碼提示 (含破解jar)

          原文地址:http://atian25.javaeye.com/blog/426824


          官方的extjs3.0包里面沒(méi)有提供ext.jsb文件.

          于是去官方論壇問(wèn)了下, 3.0他們提供的是jsb2,基于json的.

          現(xiàn)在spket還不支持。

           

          有人重新做了個(gè)臨時(shí)的3.0的jsb文件,如附件。

           

          用法:

           

          1.下載后放到3.0的src目錄下 (一定要切記...我就是一時(shí)糊涂放錯(cuò)了...在官方那鬧了笑話 -.-!!)

           

          2.然后在skpet中如下圖設(shè)置:

           


           

           

          3.設(shè)置為默認(rèn)profile


           

          4.設(shè)置完后,關(guān)閉所有標(biāo)簽頁(yè) ,重啟skpet就ok了.

           

          5.提示效果如下圖:


           

           

          關(guān)于spket和extjs的ide,請(qǐng)參考:http://www.javaeye.com/topic/161161

           

           

          09.07.23更新:

          skpet出新版本了,支持extjs的jsb2.官方下載:

          Spket IDE 1.6.17 released - 22 July 2009

          http://spket.com/

           

          09.08.11更新

          spket1.6.16的破解包,覆蓋即可.

           下載地址見(jiàn)http://atian25.javaeye.com/blog/426824文末


          09.08.12更新:

          ext.jsb2已經(jīng)包含在官方的壓縮包里面了.

          或者你可以從我另一篇blog中下載:http://atian25.javaeye.com/admin/blogs/445480

          注意:

          1.該jsb2文件需要spket1.6.17

          2.放置目錄為根目錄而不是src目錄 (跟前面的jsb文件不同)

           

          - by tz

          posted @ 2009-08-13 21:50 天豬 閱讀(2827) | 評(píng)論 (2)編輯 收藏

          ExtJS 2.3/3.0 定制你所需要的模塊

          原文地址:http://atian25.javaeye.com/blog/445480  
          天豬部落閣 - 專(zhuān)注于(ExtJS && AS3 && Java)
          附件地址見(jiàn)原文地址文末

          很實(shí)在的一個(gè)需求,就是我們只需要extjs的一部分功能,不想把整個(gè)類(lèi)庫(kù)都包含進(jìn)來(lái).

           

          所以讓我們來(lái)定制extjs吧~

           

           

          1. ExtJS 1.1.1或2.3.0

           

          可以用官方的在線工具來(lái)定制:http://extjs.com/products/extjs/build/

           

          使用教程:

          e文:http://extjs.com/learn/Tutorial:Building_Ext_From_Source

          中文:http://extjs.org.cn/node/364

           

          2. EXTJS 3.0

           

          現(xiàn)在還沒(méi)有在線版,可以通過(guò)以下方法來(lái)自己定制:

           

          1. 下載Ext 3.0.0 SDK. http://extjs.com/products/extjs/download.php?dl=extjs3 
          2. 下載JSBuilder2. http://extjs.com/products/jsbuilder/   (或者看文末的附件)
          3. 下載Ext 3.0.0的ext.jsb2文件   http://extjs.com/forum/showthread.php?p=354473  (或者看文末的附件)

          4.  把JSBuilder2解壓jar到extjs根目錄下,ext.jsb2也放到根目錄下

          5.  用你的文本編輯器編輯ext.jsb2文件,僅保留你需要的模塊

          6.  jsb2文件中的deployDir: 'ext-3.0.0-build'表示相對(duì)輸出目錄

          7.  cmd,切換到ext根目錄下,執(zhí)行:

           

          G:\Learning\Web\Javascript\ExtJS\ext-3.0.0> java -jar "JSBuilder2.jar" -p ./ext.jsb2 -d ./ 

           

          8.等待刷屏完畢后去你在jsb2中指定的目錄下找輸出吧.

           

           

          3.試驗(yàn)

          一個(gè)試驗(yàn)的例子,僅包含Tree組件,如附件

           

          1) resource部分未作過(guò)濾

          2) 注意依賴(lài)關(guān)系,如

                  name: 'Trees',
                  file: 'pkgs/pkg-tree.js',
                  isDebug: true,
                  pkgs: ['pkgs/cmp-foundation.js']

           

          3)輸出的文件樹(shù)如下:

           

          adapter\
          |--ext\
          |----ext-base.js 
          |----ext-base-debug.js

          pkgs\
          |--cmp-foundation.js 
          |--ext-foundation.js 
          |--pkg-tree.js 
          |--cmp-foundation-debug.js
          |--ext-foundation-debug.js
          |--pkg-tree-debug.js

          resources\
          license.txt

          posted @ 2009-08-13 21:48 天豬 閱讀(2402) | 評(píng)論 (1)編輯 收藏

          ExtJS 3.0 Designer Preview (官方的IDE可視化工具)

          原文地址: http://atian25.javaeye.com/blog/444581

           

          官方大爆料... http://extjs.com/blog/2009/08/10/ext-js-30-be-outstanding/

           

          Ext JS 3.0.0 Patch Release  --- 要收費(fèi)...等流放吧 ^_^
          Ext JS Public Commit Log 
          JS Builder 2 
          CSS Refactor & Improvements 
          Memory Management Improvements

           

          Designer Preview

           

          Constructing your interfaces in code will be a thing of the past. We are releasing a Designer Preview that will allow you to experiment with the designer interface and to explore how configs affect your layout. Soon, you will be able to build your application components using base Ext components and Certified User Extensions.

          Code generation is currently not available. Our intentions are to charge a fee for this service and to enable our community to create and sell their creations on our marketplace. Our goals are lofty. We want to be the iTunes of Web App Development.

           

          附件中有下載.

           

          預(yù)覽版還不提供代碼生成功能.出了也是會(huì)收費(fèi)的...

          不過(guò)嘛...群眾的智慧...

           

          另,安裝該AIR應(yīng)用后,可以自己去看下\Ext Designer Preview\deploy\designer-complete.js的源碼.

          http://jsbeautifier.org/ 來(lái)格式化

          附件中也有格式化后的代碼,9k行.




          下載地址見(jiàn)http://atian25.javaeye.com/blog/444581文末



          posted @ 2009-08-13 21:46 天豬 閱讀(6752) | 評(píng)論 (3)編輯 收藏

          [翻譯]ExtJS ChangeLog 2.2 -> 3.0.0 -- by tz

          http://atian25.javaeye.com/blog/426310


          郁悶...本來(lái)都寫(xiě)完的了...結(jié)果插入一個(gè)表格...JE編輯器就出問(wèn)題了...內(nèi)容不見(jiàn)了一半...格式也全亂了...得重來(lái)...

          翻譯的不好,請(qǐng)多見(jiàn)諒。其中有些地方覺(jué)得太拗口了,就直接給出原文了,如果你有更好的翻譯,請(qǐng)跟帖,謝謝。

          原文地址: http://extjs.com/forum/showthread.php?t=70352

          Changes, Additions  (roughly organized alphabetically)

          1.Ext

          •  新增:
            •  iterate 方法 - 遍歷一個(gè)數(shù)組或?qū)ο?對(duì)每個(gè)元素都執(zhí)行指定的函數(shù)
            •  isNumber 方法 - 判斷傳遞的參數(shù)對(duì)象是否是數(shù)字
            •  isString 方法 - 判斷傳遞的參數(shù)對(duì)象是否是字符串
            •  isBoolean 方法 - 判斷傳遞的參數(shù)對(duì)象是否是布爾值
            •  isDefined 方法 - 判斷傳遞的參數(shù)對(duì)象是否已經(jīng)定義

          2.Ext.lib.Ajax

          • 變更: Ajax responses. The core adapter file in the Ext.lib.Ajax class has been changed in line with the W3 XMLHttpRequest specification. The response object which emulates the XHR now has getResponseHeader and getAllResponseHeaders as f unctions rather than Arrays to keep inline with the real XHR object. So, anyone who was currenltly examining headers using an Array (as inherited from YUI via yui-ext) will need to change to use a function.

          3.Ext.Componet

          • 新增:
            • A Component's Observable events may now be set to bubble up the Component-ownerCt axis.

          4.Ext.BoxComponent

          • 新增:
            • getWidth() 
            • getHeight()
            • getOuterSize()

          5.Ext.Button

          • 新增:
            • Rather than being limited to only positioning buttons in a buttons configuration, they can now be placed anywhere you please. 你的按鈕現(xiàn)在可以放在任意地方,而不僅限于buttons配置項(xiàng)
            • Button現(xiàn)在可以縮放為任意高寬,并且有高級(jí)的文字布局。 (Buttons can now scale to any height or width and have advanced text positioning.)
            •  新的配置:scale: 'small'  ,  iconAlign : 'left' , arrowAlign : 'right'
          • 變更:
            • Button現(xiàn)在是一個(gè)有效的BoxComponent,可以被布局管理器管理。 (Button is now a valid BoxComponent and can partake in layout management. )
            • Button的實(shí)現(xiàn)已經(jīng)完全重寫(xiě),所以舊版本時(shí)候?qū)懙淖远x樣式/主題需要相應(yīng)的修改。(The markup for buttons is completely different and will require changes if you had implemented a custom theme. )
          6.Ext.Component
          • 新增:
            • afterrender事件
            • ref 配置項(xiàng) - establish a named reference for an object an ancestor Container (mitigate dependency on 'id' and Ext.getCmp).
            • ptypes - ComponentMgr manages plugins similar to xtypes (use Ext.preg similar to Ext.reg)
            • nextSibling
            • previousSibling
            • getDomPositionEl
          7.Ext.ComponentMgr
          • 新增:
            • isRegistered 方法 - 檢查一個(gè)xtype是否已經(jīng)被注冊(cè)
          8.Ext.Container
          • 新增:
            • get()
          9.Ext.data.Reader
          • 已過(guò)時(shí):
            • 推薦使用id, 請(qǐng)用 propertyIdidIndex
          10.Ext.data.Store
          • 新增:
            • store xtypes
            • autoDestroy  配置項(xiàng) - 當(dāng)store綁定的component被銷(xiāo)毀的時(shí)候,銷(xiāo)毀該Store
            • setBaseParam()
          • 變更:
            • baseParams可以被load方法傳遞的同名參數(shù)所覆蓋。( baseParams may be overwritten by params of same name passed to load() )
          • 已過(guò)時(shí):
            • 不推薦使用 id ,請(qǐng)用 storeId 代替它
            • 不推薦使用 loadexception 事件,請(qǐng)用 exception 事件
            • SimpleStore 更名為 ArrayStore
          11.Ext.Element
          • 新增:
            • mouseenter事件
            • mouseleave事件
          • 變更/已過(guò)時(shí):
            • getAttributeNS() - 已過(guò)時(shí),用getAttribute()代替
            • autoHeight() - 移除
            • alignTo() - 變更參數(shù)"position"
            • query() - 新增參數(shù)"unique"
            • focus() - 新增參數(shù)"defer"
          12.Ext.EventManager
          • 變更:
            • within() - can now also check if the passed element is the target or related target
          13.Ext.form
          • 新增:
            • 當(dāng)動(dòng)態(tài)添加Container到FormPanel時(shí),Fields會(huì)被添加到BasicForm's的集合中。所以BasicForm's setValues 方法現(xiàn)在可以始終對(duì)動(dòng)態(tài)添加的Fields有效。(When dynamically adding Containers anywhere in a FormPanel, any  Fields are now found and added to the BasicForm's Collection. So BasicForm's setValues  method  will now work consistently with dynamically added Fields.)
          • 變更:
            • Ext.form.Radio/Checkbox - 樣式/主題已經(jīng)被改變,詳見(jiàn)http://www.extjs.com/forum/showthread.php?p=312770#post312770.
            • Ext.form.TextField - allowBlank的驗(yàn)證行為已經(jīng)被改變,請(qǐng)參見(jiàn)文檔
            • Ext.form.FormPanel - buttonAlign  does not override the default center for Ext.Panel ('right')
          14.Ext.grid.GridPanel
          • 新增:

            • columnLines 配置項(xiàng) (boolean) - adds class ' x-grid-with-col-lines'
            •  Ext.grid.Column
              • 用來(lái)作為columns參數(shù)傳遞給ColumnModel (Instances of this class are used as columns passed to ColumnModel)
              •  xtypes可以用來(lái)指定一些預(yù)先配置好的renderer(xtypes can be used to specify a preconfigured renderer)
              • renderer may be specified in additional ways
            • Grid RowEditor Class
            • Grid like ListView and ListView.Sorter Classes (譯注:就是一個(gè)用DataView+XTemplate來(lái)模擬的Grid,輕量)
            • Grid BufferedView Class. Buffered GridView enhances performance by waiting to render rows until they are visible.(譯注:對(duì)大數(shù)據(jù)量的Grid有明顯的性能提升,實(shí)際上就是只渲染用戶(hù)可見(jiàn)的列,拖動(dòng)的時(shí)候再渲染其他.官方還有其他的一個(gè)擴(kuò)展 Ext.ux.LiveGrid,詳見(jiàn):http://extjs.com/forum/showthread.php?t=17791)
          15.Layouts:
          16.Ext.Menu
          • 新增:
            • Menu Overflow. Whenever a menu gets so long that the items won’t fit the viewable area, it provides the user with an easy UI to scroll the menu. This feature is turned on by default and can be disabled by the configuration option enableScrolling.(譯注:簡(jiǎn)單的說(shuō)就是Menu溢出后的滾動(dòng)效果,默認(rèn)是開(kāi)啟該效果,可以通過(guò)enableScrolling來(lái)配置,詳 見(jiàn)官方示例)
          • 變更/已過(guò)時(shí):
            • Toolbar and Menu are now proper Containers (formerly extended from BoxComponent). 現(xiàn)在Toolbar和Menu都繼承Container
            • Breaking change: MenuItem的ids現(xiàn)在已經(jīng)不是局部變量了,所以你不能在多個(gè)menu里面用一個(gè)id.建議:用唯一的id或者用itemIds來(lái)替代 它。(MenuItem ids are no longer local to their menu but global component ids. This means that you can't use the same id in multiple menus. Suggested fix: Use unique ids or switch to using itemIds.)
            • As well as Menu being a Container, this also means Menu can be a regular Component. Menu did not extend BoxComponent before, but was out on its own. Now, it can behave either as a regular floating Menu, or, if configured floating: false, it can be used as a usual inline Component of a Container.(譯注:簡(jiǎn)單的說(shuō)就是由于menu的繼承改變,現(xiàn)在你可以設(shè)置Menu為浮動(dòng)的,或者像平常的組件那樣使用它)
            • DateItem和ColorItem已經(jīng)被移出,因?yàn)闆](méi)有必要了,現(xiàn)在你可以把任意組件放入menu的items中
            • autoWidth() - 變更為autoSize()
          17.Ext.MenuButton - 該類(lèi)已經(jīng)被移除,用SplitButton代替它

          18.Ext.StatusBar - 該類(lèi)已經(jīng)被移出core庫(kù),在3.0final版會(huì)有個(gè)Ext.ux.StatusBar

          19.Ext.Toolbar
          • 新增:
            • Toolbar Overflow. A menu for items that don’t fit the visible toolbar area will be created by default and can be disabled with the configuration option enableOverflow. Items in the menu react with the same handlers as the toolbar items.(譯注:簡(jiǎn)單的說(shuō)就是Toolbar溢出后的滾動(dòng)效果詳見(jiàn)官方示例)
          • 變更:
            • Toolbar and Menu are now proper Containers (formerly extended from BoxComponent).現(xiàn)在Toolbar和Menu都繼承Container
          20.Ext.Tooltip
          • 新增:
            • delegate option added so one Tooltip can handle multiple child elements of its target based on selection using the delegate config.(譯注:新增的這個(gè)屬性很有用,就是通過(guò)設(shè)置的selector對(duì)某個(gè)元素的子對(duì)象設(shè)置Tip,在2.0的時(shí)候我們經(jīng)常需要的Gird RowTip,CellTip都可以實(shí)現(xiàn)了,不需要實(shí)例化很多Tip對(duì)象)
            • AnchorTips - Tooltips now support an anchor configuration which will allow you to bring attention to a particular element or component with a small callout arrow.(譯注:簡(jiǎn)單的說(shuō)就是箭頭Tip,詳見(jiàn):http://extjs.com/deploy/dev/examples/simple-widgets/qtips.html)
          21.Ext.util.Format
          • 新增/變更:
            • ellipsis() - "word" parameter added
            • focus() - "defer" parameter added
            • number() - added
            •  numberRenderer() - added
            • plural() - added
          22.Ext.util.Observable
          • 新增:
            • Ext.util.Observable.observeClass() - Class level observability 類(lèi)級(jí)別的觀察/通知
          23.ux's that worked prior to 3.x may need some tweaking (especially if the ux used private properties). ux's should be checked they are utilizing the latest preferred techniques and properties. More notes here. 舊的擴(kuò)展需要相應(yīng)的進(jìn)行修改,詳見(jiàn):http://extjs.com/forum/showthread.php?p=338913#post338913

          24.CSS. general updates, as well as refactoring to split css into visual and structural files to simplify theming.

          25.新增:圖表Charting (Chart, PieChart, CartesianChart, LineChart, BarChart - numeric, time, category axis) -- (譯注:其實(shí)就是YUI Chart,可以看:http://developer.yahoo.com/yui/charts/ , 或者可以看下我的blog:ExtJS 3.0 Chart 小用一下 http://atian25.javaeye.com/blog/413947)

          26.新增:Ext.FlashComponent (譯注:似乎是用了swfobject,管理swf方便多了,不用adobe那又長(zhǎng)又臭的代碼)

          27.新增:Direct (Direct, Ext.data.DirectStore, Ext.data.DirectProxy) - 官方3.0極力推出的東西,詳見(jiàn):http://extjs.com/blog/2009/05/13/introducing-ext-direct/

          28.新增:Writer

          29.新增:Ext.Spacer - xtype 'spacer' (for empty box component)

          30.新增:ButtonGroup (xtype: 'buttongroup')  (譯注:按鈕組,仿office2007風(fēng)格,詳見(jiàn):http://extjs.com/deploy/dev/examples/button/buttons.html)

          31.新增:GroupTabs - (譯注:詳見(jiàn)http://extjs.com/deploy/dev/examples/grouptabs/grouptabs.html)

          32.增強(qiáng):Debug Console (譯注:還是firebug好用,不過(guò)它可以看到store等,詳見(jiàn):http://extjs.com/deploy/dev/examples/debug/debug-console.html)

          33.新增:Ext.Error


          Changes to some example classes: 示例類(lèi)的修改
          (不敢用javaeye編輯器的表格了..自己將就著看吧...)

          Class                                              x(p)type                Deprecates
          Ext.ux.data.PagingMemoryProxy                                   Ext.data.PagingMemoryProxy
          Ext.ux.form.FileUploadField             fileuploadfield         Ext.ux.FileUploadField
          Ext.ux.form.SelectBox                     selectbox                Ext.ux.SelectBox
          Ext.ux.form.SpinnerField                 spinnerfield             Ext.form.SpinnerField (remove xtype=spinner)
          Ext.ux.form.ItemSelector                 itemselector           Ext.ux.ItemSelector
          Ext.ux.form.MultiSelect                    multiselect              Ext.ux.Multiselect  
          Ext.ux.grid.CheckColumn                checkcolumn (p)      
          Ext.ux.grid.GroupSummary                                            Ext.grid.GroupSummary
          Ext.ux.grid.HybridSummary                                            Ext.grid.HybridSummary
          Ext.ux.grid.RowEditor                     roweditor   (p)
          Ext.ux.grid.RowExpander               rowexpander (p)      Ext.grid.RowExpander
          Ext.ux.grid.TableGrid                                                       Ext.grid.TableGrid
          Ext.ux.GMapPanel                          gmappanel
          Ext.ux.SliderTip
          Ext.ux.SlidingPager
          Ext.ux.Spinner               
          Ext.ux.Spotlight                                                              Ext.Spotlight
          Ext.ux.Statusbar                                                            Ext.Statusbar
          Ext.ux.TabCloseMenu                    tabclosemenu (p)
          Ext.ux.tree.ColumnTree                 columntree              Ext.tree.ColumnTree
          Ext.ux.tree.ColumnNodeUI                                            Ext.tree.ColumnNodeUI
          Ext.ux.tree.XmlTreeLoader                                            Ext.ux.XmlTreeLoader

          Changes to Resources 資源的變更
          • Ensure you have updated all the Ext-provided CSS with the new CSS from version 3.
          • Ensure you have updated all the Ext-provided images with the new images from version 3.
          Additional References 其他參考

          posted @ 2009-07-15 13:26 天豬 閱讀(2889) | 評(píng)論 (0)編輯 收藏

          [原創(chuàng)]ExtJS Grid 自定義排序規(guī)則

          有一些需求如:

          1.一個(gè)文件管理的Grid,要求排序的時(shí)候,文件夾永遠(yuǎn)在頂部

          2.一個(gè)顯示成功率的Grid,要求成功數(shù)+失敗數(shù)=0的數(shù)據(jù),不參與排序,永遠(yuǎn)在底部

          ExtJs本身并沒(méi)有暴露這個(gè)接口,所以我們只能自己重寫(xiě),如下代碼:

           1 var store = new Ext.data.JsonStore({  
           2   root:'data',  
           3   fields:[  
           4     'name',  
           5     {name:'sucCount',type:'int'},  
           6     {name:'failCount',type:'int'},  
           7     {name:'sucRate',type:'float'},  
           8     {name:'isValidateTest',type:'boolean'},  
           9     {name:'statType',type:'int'},  
          10     'testLogIds','bsc','msc','sgsn'  
          11   ],  
          12   sortInfo:{field: 'sucRate', direction: 'ASC'},  
          13   //排序規(guī)則  
          14   sortData:function(f, direction){  
          15     direction = direction || 'ASC';  
          16     var dir = direction == 'ASC' ? 1 : -1;  
          17     var st = this.fields.get(f).sortType;  
          18     //關(guān)鍵地方,重寫(xiě)排序排序規(guī)則  
          19     var fn = function(r1, r2){  
          20       if(!r1.get('isValidateTest')||!r2.get('isValidateTest')){  
          21         //無(wú)效數(shù)據(jù)永遠(yuǎn)在下面  
          22         return !r1.get('isValidateTest') ? dir : -dir;  
          23       }else{  
          24         var v1 = st(r1.data[f]), v2 = st(r2.data[f]);  
          25         return v1 > v2 ? 1 : (v1 < v2 ? -1 : 0);  
          26       }  
          27     };  
          28     this.data.sort(direction, fn);  
          29     if(this.snapshot && this.snapshot != this.data){  
          30       this.snapshot.sort(direction, fn);  
          31     }  
          32   }  
          33 });

          posted @ 2009-07-01 10:20 天豬 閱讀(3066) | 評(píng)論 (0)編輯 收藏

          [原創(chuàng)]ExtJS Grid tooltip的幾種實(shí)現(xiàn)方式

          http://atian25.javaeye.com/blog/417361

          1.表頭提示

          在2.2里面是設(shè)置ColumnModel.tooltip ,3.0則是Column. tooltip 如下:

          1 var grid = new Ext.grid.GridPanel({  
          2   columns:[  
          3     {header:'名稱(chēng)',dataIndex:'name',tooltip:'對(duì)象名稱(chēng)'},  
          4     {header:'開(kāi)始時(shí)間 - 結(jié)束時(shí)間 <br/>成功/失敗/成功率', dataIndex:'sucRate',tooltip:'成功/失敗/成功率'}  
          5   ]  
          6 });

          2.單元格提示

          1)使用Ext.QuickTips

          在開(kāi)始的時(shí)候就執(zhí)行Ext.QuickTips.init();

          然后對(duì)需要提示的單元格,重寫(xiě)renderer函數(shù),添加ext:qtitle , ext:qtip這2個(gè)屬性即可。

          這個(gè)在官方的FAQ上有詳細(xì)描述: http://extjs.com/learn/Ext_FAQ_Grid#Add_ToolTip_or_Qtip

          代碼:


           1 //option 1  
           2 //========  
           3 renderer = function (data, metadata, record, rowIndex, columnIndex, store) {  
           4     //build the qtip:  
           5     var title = 'Details for&nbsp;' + value + '-+ record.get('month') +  
           6         '-+ record.get('year');  
           7     var tip = record.get('sunday_events');  
           8    
           9     metadata.attr = 'ext:qtitle="' + title + '"+ ' ext:qtip="' + tip + '"';  
          10    
          11     //return the display text:  
          12     var displayText = '<span style="color: #000;">+ value + '</span><br />+  
          13         record.get('sunday_events_short');  
          14     return displayText;  
          15 };  
          16    
          17 //option 2  
          18 //========  
          19 renderer = function (data, metadata, record, rowIndex, columnIndex, store) {  
          20     var qtip = '>';  
          21     if(data >= 0){  
          22         qtip = " qtip='yeah'/>";  
          23         return '<span style="color:green;"+ qtip + data + '%</span>';  
          24     }else if(data < 0){  
          25         qtip = " qtip='woops'/>";  
          26         return '<span style="color:red;"+ qtip + data + '%</span>';  
          27     }  
          28     return data;  
          29 };  
          30    
          31 //option 3  
          32 //========  
          33 var qtipTpl = new Ext.XTemplate(  
          34     '<h3>Phones:</h3>',  
          35     '<tpl for=".">',  
          36     '<div><i>{phoneType}:</i> {phoneNumber}</div>',  
          37     '</tpl>'  
          38 );  
          39    
          40 renderer = function (data, metadata, record, rowIndex, columnIndex, store) {  
          41    
          42     // get data   
          43     var data = record.data;  
          44    
          45     // convert phones to array (only once)   
          46     data.phones = Ext.isArray(data.phones) ?  
          47         data.phones :   
          48         this.getPhones(data.phones);  
          49    
          50     // create tooltip   
          51     var qtip = qtipTpl.apply(data.phones);  
          52    
          53     metadata.attr = 'ext:qtitle="' + title + '"+ ' ext:qtip="' + tip + '"';  
          54    
          55     //return the display text:  
          56     return data;      
          57 };

          2)使用ToolTip

          官方也已經(jīng)給出方法:

          http://extjs.com/forum/showthread.php?p=112125#post112125

          http://extjs.com/forum/showthread.php?t=55690

          以上給出的方法是可以讓一個(gè)grid里面的元素共享一個(gè)tooltip對(duì)象。一般用來(lái)做rowtip

          不過(guò)3.0有更好的方式,如下:

           

          3.行提示 RowTip

          ExtJS3.0新增的方法,設(shè)置tooltip的delegate

          代碼:


           1 var myGrid = new Ext.grid.gridPanel(gridConfig);  
           2 myGrid.on('render', function(grid) {  
           3     var store = grid.getStore();  // Capture the Store.  
           4   
           5     var view = grid.getView();    // Capture the GridView.  
           6   
           7     myGrid.tip = new Ext.ToolTip({  
           8         target: view.mainBody,    // The overall target element.  
           9   
          10         delegate: '.x-grid3-row', // Each grid row causes its own seperate show and hide.  
          11   
          12         trackMouse: true,         // Moving within the row should not hide the tip.  
          13   
          14         renderTo: document.body,  // Render immediately so that tip.body can be referenced prior to the first show.  
          15   
          16         listeners: {              // Change content dynamically depending on which element triggered the show.  
          17   
          18             beforeshow: function updateTipBody(tip) {  
          19                 var rowIndex = view.findRowIndex(tip.triggerElement);  
          20                 tip.body.dom.innerHTML = "Over Record ID " + store.getAt(rowIndex).id;  
          21             }  
          22         }  
          23     });  
          24 }); 

          4.其他方法

          監(jiān)聽(tīng)GridView或Store的事件,然后通過(guò)rowSelector或getRow方法來(lái)遍歷,自己加tooltip... 這個(gè)方式請(qǐng)無(wú)視吧

          posted @ 2009-07-01 10:14 天豬 閱讀(2508) | 評(píng)論 (0)編輯 收藏

          IE7/FF3可用的獲取異常發(fā)生所在的行數(shù)

          Error具有下面一些主要屬性:
           
              * description: 錯(cuò)誤描述 (僅IE可用).
              * fileName: 出錯(cuò)的文件名 (僅Mozilla可用).
              * lineNumber: 出錯(cuò)的行數(shù) (僅Mozilla可用).
              * message: 錯(cuò)誤信息 (在IE下同description)
              * name: 錯(cuò)誤類(lèi)型.
              * number: 錯(cuò)誤代碼 (僅IE可用).
              * stack: 像Java中的Stack Trace一樣的錯(cuò)誤堆棧信息 (僅Mozilla可用).


          在IE里面沒(méi)有l(wèi)ineNumber. 但可用下面的方法找出:

          http://forum.byr.edu.cn/wForum/disparticle.php?boardName=SoftDesign&ID=29948&pos=6&page=1

           1 <script type="text/javascript">
           2 window.onerror=testError;
           3 function testError(){
           4  arglen=arguments.length;
           5  var errorMsg="參數(shù)個(gè)數(shù):"+arglen+"個(gè)";
           6  for(var i=0;i<arglen;i++){
           7   errorMsg+="\n參數(shù)"+(i+1)+""+arguments[i];
           8  }
           9  alert(errorMsg);
          10  window.onerror=null;
          11  return true;
          12 }
          13  
          14 function test(){
          15  error
          16 }
          17 test()
          18 </script>

          posted @ 2008-09-26 14:26 天豬 閱讀(430) | 評(píng)論 (0)編輯 收藏

          主站蜘蛛池模板: 泾源县| 赣州市| 上犹县| 莱州市| 台湾省| 屏东市| 崇义县| 闻喜县| 阿拉善右旗| 南汇区| 安西县| 彰化市| 临桂县| 苍溪县| 蕉岭县| 宾阳县| 渝北区| 麟游县| 盐边县| 潞西市| 柳江县| 连城县| 青浦区| 奇台县| 梁平县| 准格尔旗| 江达县| 江山市| 馆陶县| 营山县| 舒城县| 古浪县| 通州市| 云林县| 山东省| 大关县| 绥德县| 法库县| 荆门市| 大方县| 达尔|