导入excel ImportExcel
Constructor
Implements: Widget
Tutorials: 控件对象使用快速入门
可设置的属性
| Name | Type | Description | 
|---|---|---|
name | String | 控件的名字,唯一标志 | 
title | String | 控件title | 
hidden | Boolean | 隐藏 | 
readonly | Boolean | 只读 | 
file_formno | String | 表单编号 | 
file_issave | String | 是否保存当前表单 0/1 | 
map | String | excel列映射 | 
file_start | Number | 从哪行开始读数据 | 
url | String | 上传地址 | 
hoverTip | String | 悬停提示 | 
可读取的属性
| Name | Type | Description | 
|---|---|---|
name | String | 控件的名字,唯一标志 | 
title | String | 控件title | 
readonly | Boolean | 只读 | 
hidden | Boolean | 隐藏 | 
hoverTip | String | 悬停提示 | 
方法
intoView
Description: 把控件移动到页面可视范围
调用举例:
var widget = vjsp.Parser.getWidgetByName('importExcel');
widget.doMethod('intoView');
事件
success
Description: 导入成功
回调函数参数
| Name | Type | Description | 
|---|---|---|
data | Array.<Object> | 导入的数据 | 
绑定举例:
var widget = vjsp.Parser.getWidgetByName('importExcel');
widget.on('success' , function(data){
    //控制台输出数据
    console.info('导入数据' , data);
});
formData
Description: 此事件用于修改提交的数据 此事件有默认回调 无特殊需求不要更改
回调函数参数
| Name | Type | Description | 
|---|---|---|
formData | Array.<Object> | 提交的数据 | 
绑定举例:
var widget = vjsp.Parser.getWidgetByName('importExcel');
widget.on('formData' , function(formData){
    //额外增加一个名exval的数据
    formData.exval = 'formData';
});
options
Description: 此事件用于修改初始化参数
| Name | Type | Description | 
|---|---|---|
options | Array.<Object> | 提交的数据 | 
绑定举例:
var widget = vjsp.Parser.getWidgetByName('importExcel');
widget.on('options' , function(options){
    //修改导入地址
    options.sever = 'xxx.cn/newserver.action';
});
selectFile
Description: 选择文件事件
| Name | Type | Description | 
|---|---|---|
file | File | 选择的文件对象 | 
返回值: String this.returnValue=false 可以阻止选择
绑定举例:
var widget = vjsp.Parser.getWidgetByName('importExcel');
widget.on('selectFile' , function(file){
    if(file.name === 'test.xlsx'){
        this.returnValue = false;
    }
});
beforeUpload
Description: 上传前事件 可以阻止上传
返回值: String this.returnValue=false 可以阻止上传
绑定举例:
var widget = vjsp.Parser.getWidgetByName('importExcel');
widget.on('beforeUpload' , function(){
    this.returnValue = false;
});
click
Description: 单击
回调函数参数
| Name | Type | Description | 
|---|---|---|
e | Object | jQuery事件对象 | 
绑定举例:
var widget = vjsp.Parser.getWidgetByName('importExcel');
widget.on('click' , function(e){
    vjsp.alert('click event');
});
dblclick
Description: 双击
回调函数参数
| Name | Type | Description | 
|---|---|---|
e | Object | jQuery事件对象 | 
绑定举例:
var widget = vjsp.Parser.getWidgetByName('importExcel');
widget.on('dblclick' , function(e){
    vjsp.alert('dblclick event');
});
contextmenu
Description: 弹出上下文菜单
回调函数参数
| Name | Type | Description | 
|---|---|---|
e | Object | jQuery事件对象 | 
绑定举例:
var widget = vjsp.Parser.getWidgetByName('importExcel');
widget.on('contextmenu' , function(e){
    vjsp.alert('contextmenu event');
});
mousedown
Description: 鼠标按下
回调函数参数
| Name | Type | Description | 
|---|---|---|
e | Object | jQuery事件对象 | 
绑定举例:
var widget = vjsp.Parser.getWidgetByName('importExcel');
widget.on('mousedown' , function(e){
    vjsp.alert('mousedown event');
});
mouseup
Description: 鼠标弹起
回调函数参数
| Name | Type | Description | 
|---|---|---|
e | Object | jQuery事件对象 | 
绑定举例:
var widget = vjsp.Parser.getWidgetByName('importExcel');
widget.on('mouseup' , function(e){
    vjsp.alert('mouseup event');
});
mousemove
Description: 鼠标移动
回调函数参数
| Name | Type | Description | 
|---|---|---|
e | Object | jQuery事件对象 | 
绑定举例:
var widget = vjsp.Parser.getWidgetByName('importExcel');
widget.on('mousemove' , function(e){
    vjsp.alert('mousemove event');
});
mouseover
Description: 鼠标移动控件上
回调函数参数
| Name | Type | Description | 
|---|---|---|
e | Object | jQuery事件对象 | 
绑定举例:
var widget = vjsp.Parser.getWidgetByName('importExcel');
widget.on('mouseover' , function(e){
    vjsp.alert('mouseover event');
});
mouseout
Description: 鼠标离开
回调函数参数
| Name | Type | Description | 
|---|---|---|
e | Object | jQuery事件对象 | 
绑定举例:
var widget = vjsp.Parser.getWidgetByName('importExcel');
widget.on('mouseout' , function(e){
    vjsp.alert('mouseout event');
});
mouseenter
Description: 鼠标移入
回调函数参数
| Name | Type | Description | 
|---|---|---|
e | Object | jQuery事件对象 | 
绑定举例:
var widget = vjsp.Parser.getWidgetByName('importExcel');
widget.on('mouseenter' , function(e){
    vjsp.alert('mouseenter event');
});
mouseleave
Description: 鼠标移出
回调函数参数
| Name | Type | Description | 
|---|---|---|
e | Object | jQuery事件对象 | 
绑定举例:
var widget = vjsp.Parser.getWidgetByName('importExcel');
widget.on('mouseleave' , function(e){
    vjsp.alert('mouseleave event');
});
keypress
Description: 按键按下并弹起
回调函数参数
| Name | Type | Description | 
|---|---|---|
e | Object | jQuery事件对象 | 
绑定举例:
var widget = vjsp.Parser.getWidgetByName('importExcel');
widget.on('keypress' , function(e){
    vjsp.alert('keypress event');
});
keydown
Description: 按键按下
回调函数参数
| Name | Type | Description | 
|---|---|---|
e | Object | jQuery事件对象 | 
绑定举例:
var widget = vjsp.Parser.getWidgetByName('importExcel');
widget.on('keydown' , function(e){
    vjsp.alert('keydown event');
});
keyup
Description: 按键弹起
回调函数参数
| Name | Type | Description | 
|---|---|---|
e | Object | jQuery事件对象 | 
绑定举例:
var widget = vjsp.Parser.getWidgetByName('importExcel');
widget.on('keyup' , function(e){
    vjsp.alert('keyup event');
});
blur
Description: 失去焦点
回调函数参数
| Name | Type | Description | 
|---|---|---|
e | Object | jQuery事件对象 | 
绑定举例:
var widget = vjsp.Parser.getWidgetByName('importExcel');
widget.on('blur' , function(e){
    vjsp.alert('blur event');
});
focus
Description: 获得焦点
回调函数参数
| Name | Type | Description | 
|---|---|---|
e | Object | jQuery事件对象 | 
绑定举例:
var widget = vjsp.Parser.getWidgetByName('importExcel');
widget.on('focus' , function(e){
    vjsp.alert('focus event');
});
input
Description: 正在输入
回调函数参数
| Name | Type | Description | 
|---|---|---|
e | Object | jQuery事件对象 | 
绑定举例:
var widget = vjsp.Parser.getWidgetByName('importExcel');
widget.on('input' , function(e){
    vjsp.alert('input event');
});
hidden
Description: 隐藏事件(隐藏显示触发 回调参数为隐藏状态)
回调函数参数
| Name | Type | Description | 
|---|---|---|
hiddenState | Boolean | 隐藏状态true为隐藏、false为取消隐藏 | 
绑定举例:
var widget = vjsp.Parser.getWidgetByName('importExcel');
widget.on('hidden' , function(hiddenState){
    if(hiddenState){
        vjsp.alert('控件被隐藏');
    }else{
        vjsp.alert('控件取消隐藏');
    }
});
readonly
Description: 只读事件 (只读状态改变触发 回调参数为只读状态)
回调函数参数
| Name | Type | Description | 
|---|---|---|
readonlyState | Boolean | 只读状态 true为只读、false为取消只读 | 
绑定举例:
var widget = vjsp.Parser.getWidgetByName('importExcel');
widget.on('readonly' , function(readonlyState){
    if(readonlyState){
        vjsp.alert('控件只读');
    }else{
        vjsp.alert('控件取消只读');
    }
});