Namespace: F

F

F命名空间

Classes

Accordion
AccordionPane
Base
Button
ButtonGroup
Calendar
CheckBox
CheckBoxList
Component
Container
DataList
DatePicker
DropDownBox
DropDownList
Field
FileUpload
Form
Grid
GridColumn
GroupPanel
Hidden
HtmlEditor
Label
Menu
MenuCheckBox
MenuItem
MenuItemBase
MenuSeparator
MessageBox
NumberBox
PagingToolbar
Panel
PanelBase
RadioButton
RadioButtonList
Tab
TabStrip
TextArea
TextBox
TimePicker
Tool
Toolbar
ToolbarFill
ToolbarItemBase
ToolbarSeparator
ToolbarText
Tree
TriggerBox
ViewPort
Window

Members

staticF.KEY

键盘按键代码

Methods

staticF.addCommas(string){string}

F.js, line 588
添加千分位分隔符
Name Type Description
string string 数字
Returns:
Type Description
string 包含千分位分隔符的字符串

staticF.addCSS(id, content, isCSSFile)

F.js, line 208
向页面添加CSS内容或者引用CSS文件
Name Type Description
id string 键(防止重复添加相同的内容)
content string CSS内容或者CSS文件网址
isCSSFile boolean 是否CSS文件

staticF.addDotSeparator(string, dotSeparator, commaSeparator){string}

F.js, line 605
添加小数分隔符
Name Type Description
string string 数字
dotSeparator string 小数分隔符
commaSeparator string 千分位分隔符(如果为undefined,则不添加千分位分隔符)
Returns:
Type Description
string 包含小数分隔符的字符串

staticF.addJS(id, content, isJSFile)

F.js, line 216
向页面添加JS内容或者引用JS文件
Name Type Description
id string 键(防止重复添加相同的内容)
content string JS内容或者JS文件网址
isJSFile boolean 是否JS文件

staticF.addMainTab(tabstripInstance, options, actived, moveToEnd)

F.js, line 486
添加选项卡
Name Type Default Description
tabstripInstance F.TabStrip 选项卡面板实例
options Object 选项卡参数
Name Type Default Description
id string '' 选项卡标识符
iframeUrl string '' 选项卡中内联框架的地址(默认启用iframe)
title string '' 选项卡标题
icon string '' 选项卡标题图标
iconFont string '' 选项卡标题图标字体
refreshWhenExist string '' 如果选项卡已经存在,是否刷新其中的内联框架
actived boolean true optional 是否激活选项卡(默认为true)
moveToEnd boolean false optional 将选项卡移到尾部(如果选项卡已存在,则不改变位置,默认值:false)

staticF.addMainTabByHref(tabstripInstance, treeInstance, href, actived, moveToEnd)

F.js, line 496
添加选项卡(在树中查找拥有href的树节点)
Name Type Default Description
tabstripInstance F.TabStrip 选项卡面板实例
treeInstance F.Tree 树控件实例
href string 树节点的超链接网址
actived boolean true optional 是否激活选项卡(默认为true)
moveToEnd boolean false optional 将选项卡移到尾部(如果选项卡已存在,则不改变位置,默认值:false)

staticF.alert(options)

F.js, line 133
弹出提示对话框
Name Type Description
options Object 初始参数
Name Type Default Description
target string '_self' 显示对话框的目标位置(可选项为:_self, _parent, _top)
message string '' 消息正文
title string '' 标题文本(留空则使用默认标题)
messageIcon string 'information' 消息图标(可选项为:information, warning, question, error, success)
closable boolean true 是否可关闭
ok function 点击确认按钮时执行的回调函数

staticF.beforeAjaxError(callback)

F.js, line 301
注册AJAX回发失败回调函数(返回false则不执行默认的错误处理)
Name Type Description
callback function AJAX回发失败时执行的回调函数
Example

自定义错误提示框

F.beforeAjaxError(function (data) {
	F.alert('服务器返回错误!');
	return false;
});

staticF.beforeAjaxSuccess(callback)

F.js, line 290
注册AJAX回发成功回调函数(返回false则不执行AJAX响应脚本)
Name Type Description
callback function AJAX回发成功时执行的回调函数
Example

页面跳转前弹出系统确认对话框

F.beforeAjaxSuccess(function (data) {
	// 通过返回的字符串,判断是否即将执行页面跳转
	if (data.indexOf('window.location.href=') === 0) {
		if (!window.confirm('是否执行页面跳转?')) {
			return false; // 继续留在当前页面
		}
	}
});

staticF.confirm(options)

F.js, line 146
弹出确认对话框
Name Type Description
options Object 初始参数
Name Type Default Description
target string '_self' 显示对话框的目标位置(可选项为:_self, _parent, _top)
message string '' 消息正文
title string '' 标题文本(留空则使用默认标题)
messageIcon string 'question' 消息图标(可选项为:information, warning, question, error, success)
closable boolean true 是否可关闭
ok function 点击确认按钮时执行的回调函数
cancel function 点击取消按钮时执行的回调函数

staticF.cookie(key, value, options)

F.js, line 192
新增或者修改Cookie
Name Type Description
key string
value string
options Object 参数
Name Type Default Description
path string '/' Cookie保存的网站路径(默认为网站根目录)
expires number 过期时间(单位:天;留空则为会话Cookie,浏览器关闭时自动过期)

staticF.doPostBack(url, fields, params)

F.js, line 699
自定义回发请求(F.doPostBack有两种调用形式,这种方式比较简单,推荐使用)
Name Type Description
url string 发送请求的地址
fields string optional 发送到服务器的表单字段数据,以逗号分隔多个表单字段(如果是容器,则查找容器内的所有表单字段)
params Object optional 发送到服务器的数据
Examples
function getPressedInfo(btngroup) {
	var result = {
		id: btngroup.id,
		pressed: []
	};
	$.each(btngroup.items, function (index, btn) {
		if (btn.isPressed()) {
			result.pressed.push(btn.getText());
		}
	});
	return F.toJSON(result);
}
F.doPostBack('/Button/ButtonGroupPress/ButtonGroup_PressChanged', {
	pressedInfo: getPressedInfo(F.ui.ButtonGroup3)
});
F.doPostBack('/Other/FormAjaxComplete/onForm1Submit', 'Form1', {
	key1: 'value1',
	key2: {
		'sub1': 'sub-value1',
		'sub2': 'sub-value2'
	}
});

staticF.doPostBack(options)

F.js, line 666
自定义回发请求(F.doPostBack有两种调用形式,这种方式仅在需要设置回调函数和其他参数时使用)
Name Type Description
options Object 请求参数
Name Type Description
url string 发送请求的地址
fields string 发送到服务器的表单字段数据,以逗号分隔多个表单字段(如果是容器,则查找容器内的所有表单字段)
params Object 发送到服务器的数据
complete F_doPostBack_callback 回发请求完成的回调函数
success F_doPostBack_callback 回发请求成功的回调函数
error F_doPostBack_callback 回发请求失败的回调函数
enableAjaxLoading boolean 启用回发提示
ajaxLoadingType string 回发提示的类型(可选项为:default, mask)
ajaxLoadingText string 回发提示的显示文本
ajaxLoadingMaskText string 回发提示的显示文本(ajaxLoadingType=mask)
showAjaxLoadingMaskText string 是否显示回发提示文本(ajaxLoadingType=mask)
Examples
F.doPostBack({
	url: '/Button/ButtonGroupPress/ButtonGroup_PressChanged',
	params: {
		pressedInfo: getPressedInfo(F.ui.ButtonGroup3)
	}
});
F.doPostBack({
	url: '/Other/FormAjaxComplete/onForm1Submit',
	fields: 'Form1',
	params: {
		key1: 'value1',
		key2: {
			'sub1': 'sub-value1',
			'sub2': 'sub-value2'
		}
	}
	enableAjaxLoading: false, // 不显示回发请求动画
	complete: function (data) {
		// 回发请求结束回调函数
	}
});

staticF.endsWith(value, source){boolean}

F.js, line 551
判断一个字符串是否以某个字符串结束
Name Type Description
value string 字符串
source string 源字符串
Returns:
Type Description
boolean 如果是则返回true,否则返回false

staticF.formatDate(format, value){Date}

F.js, line 457
将日期对象转换为字符串
Name Type Description
format string 日期格式化字符串(比如:'yyyy-MM-dd')
value Date 日期对象
Returns:
Type Description
Date 日期字符串
Example
日期格式规则请参考:F.parseDate

staticF.formatString(form, param)

F.js, line 414
格式化字符串
Name Type Description
form string 需要格式化的字符串
param string repeatable 参数,对应格式字符串中的 {0}, {1}, {2}...

staticF.getActiveWindow(){F.Window}

F.js, line 250
获取当前激活的窗体对象
Returns:
Type Description
F.Window 窗体对象(其 window 属性表示窗体所在的页面)

staticF.getHidden(fieldId){string}

F.js, line 258
获取隐藏字段的值(
Name Type Description
fieldId string 节点ID
Returns:
Type Description
string 隐藏字段的值

staticF.getType(typeName){object}

F.js, line 580
获取类型字符串对应的类型(例如从字符串 'tabstrip' 获取类型 F.TabStrip)
Name Type Description
typeName string 类型字符串
Returns:
Type Description
object 类型

staticF.hasHScrollbar(el){boolean}

F.js, line 566
是否存在水平滚动条
Name Type Description
el jQuery 节点
Returns:
Type Description
boolean 是否存在水平滚动条

staticF.hasVScrollbar(el){boolean}

F.js, line 573
是否存在垂直滚动条
Name Type Description
el jQuery 节点
Returns:
Type Description
boolean 是否存在水平滚动条

staticF.htmlDecode(value){string}

F.js, line 230
HTML解码
Name Type Description
value string 输入值
Returns:
Type Description
string 解码后的值

staticF.htmlEncode(value){string}

F.js, line 223
HTML编码
Name Type Description
value string 输入值
Returns:
Type Description
string 编码后的值

staticF.initTreeTabStrip(treeMenu, mainTabStrip, options)

F.js, line 534
初始化官网示例框架(左侧树与右侧选项卡面板交互)
Name Type Description
treeMenu F.Tree 左侧树实例
mainTabStrip F.TabStrip 选项卡面板实例
options Object 可选参数
Name Type Description
updateHash boolean 切换Tab时,是否更新地址栏Hash值(默认值:true)
refreshWhenExist boolean 添加选项卡时,如果选项卡已经存在,是否刷新内部IFrame(默认值:false)
refreshWhenTabChange boolean 切换选项卡时,是否刷新内部IFrame(默认值:false)
maxTabCount number 最大允许打开的选项卡数量
maxTabMessage string 超过最大允许打开选项卡数量时的提示信息
beforeNodeClick F_initTreeTabStrip_beforeNodeClick 节点点击事件之前执行(返回false则不执行点击事件)
beforeTabAdd F_initTreeTabStrip_beforeTabAdd 添加选项卡之前执行(返回false则不添加选项卡)
singleTabId string 单标签页模式下的标签页标识符(留空即为多标签页模式)
moveToEnd boolean 将选项卡移到尾部(如果选项卡已存在,则不改变位置,默认值:false)
Example
F.initTreeTabStrip(F.ui.Tree1, F.ui.TabStrip1, {
    maxTabCount: 10,
    maxTabMessage: '请先关闭一些选项卡(最多允许打开 10 个)!'
});

staticF.isARR(value){boolean}

F.js, line 317
测试对象是否为数组
Name Type Description
value object 需要测试的对象
Returns:
Type Description
boolean 测试结果

staticF.isBOO(value){boolean}

F.js, line 324
测试对象是否为布尔型
Name Type Description
value object 需要测试的对象
Returns:
Type Description
boolean 测试结果

staticF.isDAT(value){boolean}

F.js, line 359
测试对象是否为日期对象
Name Type Description
value object 需要测试的对象
Returns:
Type Description
boolean 测试结果

staticF.isELE(value){boolean}

F.js, line 387
测试对象是否为DOM节点元素
Name Type Description
value object 需要测试的对象
Returns:
Type Description
boolean 测试结果

staticF.isEMP(value){boolean}

F.js, line 380
测试对象是否为空(undefined, null 或者 空字符串)
Name Type Description
value object 需要测试的对象
Returns:
Type Description
boolean 测试结果

staticF.isEOBJ(value){boolean}

F.js, line 373
测试对象是否为空对象(不包含任何属性)
Name Type Description
value object 需要测试的对象
Returns:
Type Description
boolean 测试结果

staticF.isFUN(value){boolean}

F.js, line 310
测试对象是否为函数
Name Type Description
value object 需要测试的对象
Returns:
Type Description
boolean 测试结果

staticF.isNAN(value){boolean}

F.js, line 338
测试对象是否为NaN
Name Type Description
value object 需要测试的对象
Returns:
Type Description
boolean 测试结果

staticF.isNUM(value){boolean}

F.js, line 331
测试对象是否为数字
Name Type Description
value object 需要测试的对象
Returns:
Type Description
boolean 测试结果

staticF.isPOBJ(value){boolean}

F.js, line 366
测试对象是否为纯粹对象(通过 {} 或者 new Object 创建的对象)
Name Type Description
value object 需要测试的对象
Returns:
Type Description
boolean 测试结果

staticF.isSTR(value){boolean}

F.js, line 345
测试对象是否为字符串
Name Type Description
value object 需要测试的对象
Returns:
Type Description
boolean 测试结果

staticF.isUND(value){boolean}

F.js, line 352
测试对象是否为undefined或者null
Name Type Description
value object 需要测试的对象
Returns:
Type Description
boolean 测试结果

staticF.noAnimation(fn)

F.js, line 121
回调函数中不进行动画操作
Name Type Description
fn function 回调函数

staticF.noEvent(fn)

F.js, line 109
回调函数中不触发事件
Name Type Description
fn function 回调函数

staticF.noLayout(fn)

F.js, line 94
回调函数中不进行布局操作
Name Type Description
fn function 回调函数

staticF.notify(options)

F.js, line 182
弹出通知对话框
Name Type Description
options Object 初始参数
Name Type Default Description
target string '_self' 显示对话框的目标位置(可选项为:_self, _parent, _top)
message string '' 消息正文
title string '' 标题文本(留空则使用默认标题)
messageIcon string 'question' 消息图标(可选项为:information, warning, question, error, success)
closable boolean true 是否可关闭
hide function 对话框隐藏时执行的回调函数
modal boolean false 是否为模式对话框
draggable boolean true 是否可拖动
header boolean true 是否显示标题栏
showLoading boolean false 是否显示正在加载图标
positionX string 'right' 横坐标的位置(可选项为:left, center, right)
positionY string 'bottom' 纵坐标的位置(可选项为:top, center, bottom)
displayMilliseconds number 0 自动消失之前显示的秒数(0-不消失)

staticF.noValidate(fn)

F.js, line 115
回调函数中不验证表单字段
Name Type Description
fn function 回调函数

staticF.parseDate(format, value){Date}

F.js, line 447
将字符串转换为日期对象
Name Type Description
format string 日期格式化字符串(比如:'yyyy-MM-dd')
value string 日期字符串
Returns:
Type Description
Date 日期对象
Example
d     -   月中的某一天,一位数的日期没有前导零。
dd    -   月中的某一天,一位数的日期有一个前导零。
ddd   -   周中某天的缩写名称。
dddd  -   周中某天的完整名称。
M     -   月份数字,一位数的月份没有前导零。
MM    -   月份数字,一位数的月份有一个前导零。
MMM   -   月份的缩写名称。
MMMM  -   月份的完整名称。
yy    -   不包含纪元的年份。
yyyy  -   包括纪元的四位数的年份。
h     -   12小时制的小时,一位数的小时数没有前导零。
hh    -   12小时制的小时,一位数的小时数有前导零。
H     -   24小时制的小时,一位数的小时数没有前导零。
HH    -   24小时制的小时,一位数的小时数有前导零。
m     -   分钟,一位数的分钟数没有前导零。
mm    -   分钟,一位数的分钟数有一个前导零。
s     -   秒,一位数的秒数没有前导零。
ss    -   秒,一位数的秒数有一个前导零。

staticF.parseJSON(value){Object}

F.js, line 464
将JSON字符串转换为JavaScript对象
Name Type Description
value string JSON字符串
Returns:
Type Description
Object JavaScript对象

staticF.progressHtml(value, options)

F.js, line 747
生成进度条HTML片段
Name Type Description
value Object 初始值
options Object 初始参数
Name Type Default Description
height number 进度条的高度
textVisible boolean false 是否显示进度条文本
textInside boolean false 是否将进度条文本显示在进度条内部

staticF.prompt(options)

F.js, line 163
弹出输入对话框
Name Type Description
options Object 初始参数
Name Type Default Description
target string '_self' 显示对话框的目标位置(可选项为:_self, _parent, _top)
message string '' 消息正文
title string '' 标题文本(留空则使用默认标题)
messageIcon string 'question' 消息图标(可选项为:information, warning, question, error, success)
closable boolean true 是否可关闭
ok function 点击确认按钮时执行的回调函数(回调函数的第一个参数为用户输入值)
cancel function 点击取消按钮时执行的回调函数(回调函数的第一个参数为用户输入值)
multiLine boolean false 是否显示多行输入框
multiLineHeight number 多行输入框的高度
defaultValue string '' 输入框的缺省值
required boolean false 输入框是否为必填项

staticF.queryString(name, url){string}

F.js, line 559
获取URL中的参数值
Name Type Description
name string 参数名
url string optional 在指定URL中查找(留空在当前页面URL中查找)
Returns:
Type Description
string URL中参数名对应的值

staticF.rateEvents(container, callback)

F.js, line 735
注册评分事件
Name Type Description
container jQuery 评分容器
callback F_rateEvents_callback 评分改变的回调函数

staticF.rateHtml(value, options)

F.js, line 719
生成评分HTML片段
Name Type Description
value Object 初始值
options Object 初始参数
Name Type Default Description
allowClear boolean true 是否允许通过点击来清除评分
allowHalf boolean false 是否允许半星评分
iconFont string '' 评分图标字体
iconFontCls string '' 自定义评分图标字体的样式类
character string '' 自定义评分字符
count number 5 评分图标的个数
readonly boolean false 是否只读
textVisible boolean false 是否显示评分文本
textRenderer function 自定义评分文本的渲染函数

staticF.ready(callback)

F.js, line 275
注册页面渲染完毕回调函数
Name Type Description
callback function 页面加载完毕时执行的回调函数

staticF.removeCommas(string){string}

F.js, line 595
移除千分位分隔符
Name Type Description
string string 数字
Returns:
Type Description
string 不包含千分位分隔符的字符串

staticF.removeCookie(key, options)

F.js, line 200
删除Cookie
Name Type Description
key string
options Object 参数
Name Type Default Description
path string '/' Cookie保存的网站路径(默认为网站根目录)

staticF.removeDotSeparator(string, dotSeparator, commaSeparator){string}

F.js, line 615
移除小数分隔符
Name Type Description
string string 数字
dotSeparator string 小数分隔符
commaSeparator string 千分位分隔符(如果为undefined,则表示输入的数字不包含千分位分隔符)
Returns:
Type Description
string 不包含小数分隔符的字符串

staticF.removeHidden(fieldId)

F.js, line 269
删除隐藏字段(
Name Type Description
fieldId string 节点ID

staticF.reset(containerId)

F.js, line 420
重置容器内的全部表单字段
Name Type Description
containerId string 容器标识符(留空则重置页面上的全部表单字段)

staticF.setHidden(fieldId, fieldValue)

F.js, line 264
设置隐藏字段的值(
Name Type Description
fieldId string 节点ID
fieldValue string 设置的值

staticF.smartLayout(fn)

F.js, line 102
回调函数执行完毕后再进行布局操作
Name Type Description
fn function 回调函数

staticF.startsWith(value, source){boolean}

F.js, line 543
判断一个字符串是否以某个字符串开头
Name Type Description
value string 字符串
source string 源字符串
Returns:
Type Description
boolean 如果是则返回true,否则返回false

staticF.toJSON(value){string}

F.js, line 471
将JavaScript对象转换为JSON字符串
Name Type Description
value Object JavaScript对象
Returns:
Type Description
string JSON字符串

staticF.ui(options){F.Component}

F.js, line 14
创建控件实例
Name Type Description
options object 初始参数
Returns:
Type Description
F.Component 控件实例

staticF.urlDecode(url){string}

F.js, line 244
URL解码
Name Type Description
url string 输入值
Returns:
Type Description
string 解码后的值

staticF.urlEncode(url){string}

F.js, line 237
URL编码
Name Type Description
url string 输入值
Returns:
Type Description
string 编码后的值

staticF.validateForm(form, target, showMessageBox, messageBoxPlain){object}

F.js, line 407
验证单个表单
Name Type Default Description
form string 需要验证的表单标识符
target string '_self' 验证失败时显示对话框的目标位置(可选项为:_self, _parent, _top)
showMessageBox boolean true 验证失败时是否显示对话框
messageBoxPlain boolean false 是否简单对话框
Returns:
Type Description
object 验证结果(数组:[是否验证通过,第一个验证失败的表单字段标识符])

staticF.validateForms(forms, target, showMessageBox, messageBoxPlain){object}

F.js, line 397
验证多个表单
Name Type Default Description
forms Array.<string> 需要验证的表单标识符数组
target string '_self' 验证失败时显示对话框的目标位置(可选项为:_self, _parent, _top)
showMessageBox boolean true 验证失败时是否显示对话框
messageBoxPlain boolean false 是否简单对话框
Returns:
Type Description
object 验证结果(数组:[是否验证通过,第一个验证失败的表单字段标识符])

staticF.windowResize(fn)

F.js, line 86
注册页面大小改变事件(延迟 500 毫秒触发)
Name Type Description
fn function 回调函数