Tool

FineUI. Tool

new Tool(options)

Description:
  • 工具图标控件

Examples

工具图标通常作为FineUI.Panel/FineUI.Grid标题栏右侧的小图标按钮使用:

FineUI.create({
	type: 'Panel', renderTo: document.body, width: 600, height: 200, title: '面板', bodyPadding: 10,
	tools: [
		{ type: 'Tool', iconFont: 'refresh', tooltip: '刷新', handler: function () { FineUI.alert('刷新'); } },
		{ type: 'Tool', iconFont: 'gear', tooltip: '设置' },
		{ type: 'Tool', iconFont: 'close', tooltip: '关闭' }
	]
});

工具图标可以挂菜单,类似FineUI.Button

FineUI.create({
	type: 'Panel', renderTo: document.body, width: 600, height: 200, title: '面板', bodyPadding: 10,
	tools: [{
		type: 'Tool', iconFont: 'gear', tooltip: '设置',
		menu: {
			type: 'Menu',
			items: [
				{ type: 'MenuItem', text: '导出' },
				{ type: 'MenuItem', text: '打印' }
			]
		}
	}]
});
Parameters:
Name Type Description
options Object

初始参数

Properties
Name Type Default Description
icon string ''

图标

iconFont string ''

图标字体

iconFontCls string ''

自定义图标字体的样式类

text string ''

显示文本

type string 'Tool'

控件类型

Extends

Members

el :jQuery

Description:
  • 控件对应的jQuery节点对象

Inherited From:

控件对应的jQuery节点对象

Type:
  • jQuery

Methods

getEncodedText(text) → {string}

Description:
  • 获取编码后的字符串

Inherited From:
Parameters:
Name Type Description
text string

原始字符串

Returns:

编码后的字符串

Type
string

hidePopEl()

Description:
  • 隐藏弹出菜单

isType(value) → {boolean}

Description:
  • 检测当前实例是否指定的控件类型

Inherited From:
Example
grid1.isType('panel') // 返回true
grid1.isType('grid')  // 返回true
Parameters:
Name Type Description
value Object

控件类型

Returns:

如果当前实例是指定的控件类型,返回true;否则返回false

Type
boolean

showPopEl()

Description:
  • 显示弹出菜单

Events

beforeclick

Description:
Parameters:
Name Type Description
event jQuery.Event

事件对象

beforehide

Description:
  • 隐藏控件之前触发(返回false则取消隐藏操作)

Inherited From:

beforeshow

Description:
  • 显示控件之前触发(返回false则取消显示操作)

Inherited From:

click

Description:
  • 点击工具图标时触发(返回false则不执行handler方法)

Parameters:
Name Type Description
event jQuery.Event

事件对象

hide

Description:
  • 隐藏控件时触发

Inherited From:

layout

Description:
  • 布局控件时触发

Inherited From:

remove

Description:
  • 移除控件时触发(调用 remove() 时,控件 DOM 被销毁之前触发;可用于清理外部资源 / 解绑全局事件)

Inherited From:

render

Description:
  • 渲染控件时触发

Inherited From:

show

Description:
  • 显示控件时触发

Inherited From: