API Docs for: 0.2
Show:

window.Bizs.MultiAutoComplete Class

级联 Suggest

require: JC.AutoComplete , JC.Placeholder , JC.Panel

JC Project Site | API docs | demo link

页面只要引用本脚本, 默认会自动处理 input[defaultMultiAutomComplete]

可用的 HTML attribute

defaultMultiAutomComplete = empty
声明第一级联动框
macUrl = url
获取数据的URL接口
macAddtionUrl = url
用于最后一级的附加数据接口, 如果所有父级没有选中内容, 将启用该接口
macAddtionBox = selector
指定用于保存选择内容的选择器
macAddtionBoxItemTpl = selector
保存内容项的模板
macAddtionBoxItemSelector = selector
保存内容项的选择器
macAddtionItemAddCallback = callback
添加保存内容项时的回调 function macAddtionItemAddCallback( _item, _id, _label, _parent, _parentBox ){ var _macIns = this; JC.log( 'macAddtionItemAddCallback', _id, _label ); }
macAddtionItemRemoveCallback = callback
删除保存内容项时的回调 function macAddtionItemRemoveCallback( _item, _id, _label, _parent, _parentBox ){ var _macIns = this; JC.log( 'macAddtionItemRemoveCallback', _id, _label ); }

Constructor

window.Bizs.MultiAutoComplete

(
  • _selector
)

Parameters:

Example:

<div class="ui-sug-mod"> <input type="text" class="ui-sug-ipt js_compAutoComplete js_k1" name="k1" value="" autocomplete="off" cacPopup="/ul.js_compAutoCompleteBox" cacLabelKey="data-label" cacIdKey="data-id" cacIdSelector="/input.js_k1_id" cacStrictData="true" cacDataFilter="cacDataFilter" cacNoDataText="暂无数据!" cacPreventEnter="true" defaultMultiAutomComplete="" macUrl="./data/shengshi_with_error_code.php?id=0" macTarget="/input.js_k2" Placeholder="一级位置" /> <input type="hidden" value="14" class="js_k1_id" name="k1_id" /> <input type="text" class="ui-sug-ipt js_compAutoComplete js_k2" name="k2" value="" autocomplete="off" cacPopup="/ul.js_compAutoCompleteBox" cacLabelKey="data-label" cacIdKey="data-id" cacIdSelector="/input.js_k2_id" cacStrictData="true" cacDataFilter="cacDataFilter" cacNoDataText="暂无数据!" cacPreventEnter="true" macUrl="./data/shengshi_with_error_code.php?id={0}" macTarget="/input.js_k3" Placeholder="二级位置" /> <input type="hidden" value="2341" class="js_k2_id" name="k2_id" /> <input type="text" class="ui-sug-ipt js_compAutoComplete js_k3" name="k3" value="区" autocomplete="off" Placeholder="三级位置" cacPopup="/ul.js_compAutoCompleteBox" cacLabelKey="data-label" cacIdKey="data-id" cacStrictData="false" cacDataFilter="cacDataFilter" cacNoDataText="暂无数据!" cacAddtionItem="true" cacListItemTpl="/script.cacItemTpl" cacPreventEnter="true" macUrl="./data/shengshi_with_error_code.php?id={0}" macAddtionUrl="./data/shengshi_with_error_code.php?id=0" macAddtionBox="/.js_macAddtionBox" macAddtionBoxItemTpl="/script.macAddtionBoxItemTpl" macAddtionBoxItemSelector="> a" macAddtionItemAddCallback="macAddtionItemAddCallback" macAddtionItemRemoveCallback="macAddtionItemRemoveCallback" /> <span class="js_macAddtionBox" style="display:none;"> <span class="js_macAddtionBoxList"> <a href="javascript:" class="js_macAddtionBoxItem" data-id="2345" id="macAddtionBoxItemId_1_2345" data-label="枫溪区"> <label>枫溪区</label> <button type="button" class="AURemove"></button> <input type="hidden" name="condition[]" value="2345"> </a> </span> <a href="javascript:" class="js_macClearAddtionList"> 清空<button type="button" class="AUClose"></button> </a> </span> <script type="text/template" class="cacItemTpl"> <li data-id="{0}" data-label="{1}" data-index="{2}" class="AC_listItem {3} js_macAddtionBoxItemClick"> <a href="javascript:;" data-id="{0}" data-label="{1}" data-index="{2}" class="AC_control AC_customAdd">添加</a> <label>{1} </label> </li> </script> <script type="text/template" class="macAddtionBoxItemTpl"> <a href="javascript:" class="js_macAddtionBoxItem" data-id="{0}" id="{2}" data-label="{1}"> <label>{1}</label> <button type="button" class="AURemove"></button> <input type="hidden" name="condition[]" value="{0}" /> </a> </script> </div>

Methods

_beforeInit

() private

初始化之前调用的方法

_init

(
  • _selector
)
private

内部初始化方法

Parameters:

  • _selector Selector

_inited

() private

内部初始化完毕时, 调用的方法

_initHanlderEvent

() private

内部事件初始化方法

init

(
  • _selector
)
Array of MultiAutoCompleteInstance static

初始化可识别的 MultiAutoComplete 实例

Parameters:

  • _selector Selector

Returns:

Array of MultiAutoCompleteInstance:

notification

(
  • _evtName
  • _args
)

通知选择器有新事件
JC 组件以后不会在 HTML 属性里放回调, 改为触发 selector 的事件

Parameters:

notificationHandler

(
  • _evtName
  • _args
)

通知选择器有新事件, 有返回结果
JC 组件以后不会在 HTML 属性里放回调, 改为触发 selector 的事件

Parameters:

Returns:

:

on

(
  • _evtName
  • _cb
)

使用 jquery on 绑定事件

Parameters:

Returns:

BaseMVCInstance

selector

()

获取 显示 BaseMVC 的触发源选择器, 比如 a 标签

Returns:

selector

trigger

(
  • _evtName
  • _args
)

使用 jquery trigger 触发绑定事件

Parameters:

Returns:

BaseMVCInstance

triggerHandler

(
  • _evtName
  • _args
)

使用 jquery triggerHandler 触发绑定事件

Parameters:

Returns:

: