远-方的博客

dijit.layout.ContentPane--dojo学习

Content Pane是一个最基础的布局组件,概念上,这就象一个装内容的盒子,一个Content

Pane象一个iframe,但是它还包括额外的设计功能,自适应当前的皮肤,以及实现widgets的

属性。

 

使用方法:
你可以直接使用content pane,但通常情况下,你应该把content pane放在一个布局容器中

,例如:一个tabbed layout。

 

Href:
content panes的一个最大的用处是通过href参数来动态调入内容。但是要注意,href属性

只能访问同一个域中的数据,因为它是通过XHR来实现的。

content pane来是一些widgets的基类,如:Dialog。

 

Loading Message
当内容正在被读入的时候,显示的loading信息,可以通过改变ContentPane的

loadingMessage属性来改变。loadMessage属性的默认值是"<span

class='dijitContentPaneLoading'>${loadingState}</span>" ,所以,你可以通过应用

css到.dijitContentPaneLoading class来改变显示的信息。

 

回调Callbacks
当内容通过href读入时,一定数量的回调函数可以配置使用,在读入内容的不同阶段将会执

行:
onDownloadStart
Called before the download of the content begins.
onDownloadEnd
Called when the content has completed loading.
onDownloadError(error)
Called if there was an error with the download.

 

An example of using a callback might be as follows:

var myCp= dijit.byId("myContentPane");
myCp.attr("onDownloadEnd", function(){
  console.log("Download complete!");
});
myCp.attr("href", "myHtml.html");


 

posted on 2009-12-03 10:20  远-方  阅读(1925)  评论(0编辑  收藏  举报

导航