data 插件列表的数据源

  • Type: object | string
  • Default: 无默认值,该参数为必填参数
  • Usage:

    数据源可以是json数据格式或URL

    json数据格式
    [{id:1,name:'张三',sex:'男'},{id:2,name:'李四',sex:'男'}]

    如上所例数据,showField可设置为name或sex,keyField可设置为id

    url
    http://xxx.com/load

    使用URL执行ajax读取服务端数据,返回数据格式与上述json数据格式一致

showField 显示在列表中的数据字段

  • Type: string
  • Default: 'name'
  • Usage:
    设置的值为data数据源中的数据字段名

keyField 数据代码列

  • Type: string
  • Default: 'id'
  • Usage:
    设置的值为data数据源中的数据字段名

lang 插件语言,默认为'cn'简体中文

  • Type: string
  • Default: 'cn'
  • Usage:
    可设置的语言
    代码 语言 描述
    de German 德语
    en English 英文
    cn Chinese 中文
    es Spanish 西班牙语
    pt-br Brazilian Portuguese 巴西葡萄牙语
    ja Japanese 日语

searchField 查询关键字字段

  • Type: string
  • Default:
  • Usage:
    查询字段,仅为使用URL(ajax)方式查询服务端时,设置后端查询的字段,不设置则默认使用showField设置的字段

dropButton 下拉按钮显示状态

  • Type: boolean
  • Default: true
  • Usage:
    设置插件插件的下拉按钮是否显示,默认显示(true)

multiple 多选模式

  • Type: boolean
  • Default: false
  • Usage:
    设置插件选择模式,默认为单选模式

listSize 关闭分页的状态下,列表显示的项目个数,其它的项目以滚动条滚动方式展现

  • Type: number
  • Default: 10
  • Usage:

    设置关闭分页模式时,列表的高度以显示多少个项目为准

multipleControlbar 是否启用多选模式的控制按钮区域,仅multiple: true模式下可用

  • Type: boolean
  • Default: true
  • Usage:
    设置插件是否启用多选模式的控制按钮区域,仅multiple: true模式下可用

maxSelectLimit 多选模式下最大选择个数,0为不限制

  • Type: number
  • Default: 0
  • Usage:
    设置插件最多可以选择的项目,仅multiple: true模式下可用

selectToCloseList 选中项目后关闭列表

  • Type: boolean
  • Default: false
  • Usage:
    设置在选中项目后,关闭列表,仅multiple: true模式下可用

focusDropList 是否在输入框获得焦点时,展开下拉窗口

  • Type: boolean
  • Default: true
  • Usage:
    设置当输入框获得焦点时,是否展开数据列表

autoFillResult 是否自动填充内容

  • Type: boolean
  • Default: false
  • Usage:
    若有列表项目被高亮显示,在焦点离开控件后,自动设置该项为选中内容

    在多选模式下,该参数会被强制关闭

autoSelectFirst 是否自动选择列表中的第一项内容

  • Type: boolean
  • Default: false
  • Usage:
    是否自动选择列表中的第一项内容(输入关键字查询模式,直接使用鼠标下拉并不触发)

    该参数生效需依赖 autoFillResult 设置为 true

    在多选模式下,该参数会被强制关闭

noResultClean 是否清空输入关键字

  • Type: boolean
  • Default: true
  • Usage:
    在输入框中输入内容进行查询,但没有匹配的内容返回,在焦点离开控件后,自动清空输入框输入的内容

formatItem 列表项目显示内容格式化

  • Type: function
  • Default:
  • Usage:
    参数1:data,行数据object格式 返回:string

andOr 查询方式 ('AND' or 'OR')

  • Type: string
  • Default: 'AND'
  • Usage:

    andOr : 'OR'

    参数指定了插件在使用多关键字过滤时,处理的逻辑,多关键字之间使用半角空格隔开

orderBy data list sort type

  • Type: boolean|array
  • Default: false
  • Usage:

    orderBy : ['id desc','name']

    设置为 false,则关闭排序;若只指定了列,而不指定排序方式,则默认使用Asc升序排列,列和排序方式之间使用半角空格隔开

pageSize 每页显示记录数

  • Type: number
  • Default: 10

inputDelay 输入关键字查询延迟(仅ajax数据源模式下可用)

  • Type: number
  • Default: 0.5
  • Usage:

    该参数指定了在ajax数据源模式下,延迟输入查询的时间,避免在单位时间内连续输入发起的连续ajax查询,单位:秒,Default: 0.5

params 查询参数

  • Type: function
  • Default:
  • Usage:

    使用URL进行AJAX查询时,可传递查询参数

    返回结果格式:{'name':'aa','sex':1}

    例如:params : function(){return {'name':'aa','sex':1};}

eAjaxSuccess ajax请求模式,请求成功后的数据处理回调

  • Type: function
  • Default:
  • Usage:
    参数:data:ajax服务端返回的json数据

    eAjaxSuccess : function(data){ return data.pageinfo; }

    返回的数据格式:

    { list : [{name:'aa',sex:1},{name:'bb',sex:1}...], totalRow : 100 }

eSelect 事件回调,响应项目被选中后的事件处理

  • Type: function
  • Default:
  • Usage:
    参数:data:选中行的原始JSON数据

    eSelect : function(data){ $('xxx').val(data.name + data.sex); }

eOpen 事件回调,在列表显示之前执行的回调,用于数据、参数准备

  • Type: function
  • Default:
  • Usage:
    参数:self:插件内部对象,可获取插件的所有资源

    eOpen : function(self){ }

eTagRemove selected clear, selected tags removed 's callbacks

  • Type: function
  • Default:
  • Usage:
    Params: datas[array] - removed item raw data

    eTagRemove : function(datas){}

eClear 单选模式下,清除按钮的功能回调

  • Type: function
  • Default:
  • Usage:

    eClear : function(){}

$.fn.selectPageClear 清除所有模式下选择的项目

  • Type: function
  • Default:
  • Usage:

    $('#selectPage').selectPageClear();

$.fn.selectPageRefresh 刷新选中项目内容

  • Type: function
  • Default:
  • Usage:
    使用场景:使用$().val('xxx')修改插件的选中项目ID,此时需要刷新插件在输入框中的显示文本

    $('#selectPage').val('5');
    $('#selectPage').selectPageRefresh();

$.fn.selectPageData 动态修改插件数据源

  • Type: function
  • Default:
  • Usage:
    参数:data:新数据源

    var data = [{name:'aa',sex:1},{name:'bb',sex:0},{...}]; $('#selectPage').selectPageData(data);

$.fn.selectPageText 获得选中项目的文本

  • Type: function
  • Default:
  • Usage:

    alert($('#selectPage').selectPageText());