表1--jQuery UI Portlet 插件API
参数 描述 默认值
sortable 是否启用拖动功能,内部调用sortable插件 true
singleView 是否开启单视图模式,双击标题栏可启用单视图模式 true
create 当创建portlet组件时被调用 null
removeItem 关闭一个portlet时的回调函数 null
columns 见表2 null
表2--jQuery UI Portlet 插件API--columns
参数 描述 默认值
width 宽度 300
portlets
参数 描述 默认值
attrs portlet的属性, json数组格式  
title portlet的title,支持:静态文本,function  
icon 标题栏左侧的图标,使用jQuery UI提供的图标. icon: 'ui-icon-person'  
beforeRefresh 刷新portlet之前被调用  
afterRefresh 刷新portlet之后被调用  
singleView
  • width:启用单视图模式时portlet的宽度;设置方式:数字、function;默认:body的宽度
  • height:启用单视图模式时portlet的高度;设置方式:数字、function;默认:使用原高度
  • enable:触发单视图模式后回调
  • recovery:关闭(还原)单视图模式后回调
 
content
  • type:内容获取方式:text、ajax
  • text:portlet的内容,html或者function
  • style:设置内容区域的样式,目前支持属性:height
  • beforeShow:设置内容之前被调用
  • afterShow:设置内容之后被调用
  • url:当type:'ajax'时需要指定数据来源的网址
  • dataType:当type:'ajax'时需要指定获取的数据类型,所有jquery的ajax支持的数据类型,目前支持:html、json
  • formatter:当type:'ajax'并且dataType:'json'时被调用,用来处理json数据从而转换为html。
    调用时传入三个参数:[表1中的参数,本表中的参数, 数据]
  • error:当ajax请求出现错误时调用,参数参考jqueyr的api,this对象为当前的内容区域
 
scripts 数组:指定portlet加载完内容后的js文件路径  
表3--jQuery UI Portlet 插件更新参数 $('#portlet1').portlet('option', 'paramName', paramValue)
参数名称 描述
sortable 设置开启/禁用拖动功能