123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464 |
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <title></title>
- <!--框架必需start-->
- <script type="text/javascript" src="../../libs/js/jquery.js"></script>
- <script type="text/javascript" src="../../libs/js/language/cn.js"></script>
- <script type="text/javascript" src="../../libs/js/framework.js"></script>
- <link href="../../libs/css/import_basic.css" rel="stylesheet" type="text/css"/>
- <link rel="stylesheet" type="text/css" id="skin" prePath="../../"/>
- <link rel="stylesheet" type="text/css" id="customSkin"/>
- <!--框架必需end-->
- <!--提示下拉框start-->
- <script type='text/javascript' src='../../libs/js/form/selectSuggestion.js'></script>
- <!--提示下拉框end-->
- </head>
- <body>
- <div class="box1" panelWidth="800">
- <fieldset>
- <legend>说明</legend>
- 提示下拉框点击右侧箭头按钮展开下拉列表,点击文本框可以进行输入过滤。<br/>
- 默认有输入验证功能,即输入的文本在列表里面不存在时,会自动清除。此功能可禁用,这时可以输入任意文本。<br/>
- 相比单选下拉框组件,除了有输入提示功能外,还有选项标签式分组,数据列表分页,键盘操作进行翻页和选中等额外功能(键盘操作在点击文本框展开列表时有效,点击按钮时无效)。缺少联动,动态修改选项功能。<br/>
- </fieldset>
- <div class="height_15"></div>
-
-
- <fieldset>
- <legend>1、通过url获取数据源</legend>
- <div class="red">此示例由后台支持</div>
- <!--
- <div class="selectSuggestion" url="../../autoComplateAction.do?method=getListOfCity" id="sug-1"></div>
- <input type="button" value="获取值" onclick="getValue()" />
- <br/>还可通过url+参数获取数据源,用法同单选下拉框
- -->
- </fieldset>
- <div class="height_15"></div>
-
- <fieldset>
- <legend>2、通过设置data数据获取数据源</legend>
- <div class="selectSuggestion" id="suggestion2" keepDefaultStyle="true"></div>
- </fieldset>
- <div class="height_15"></div>
-
- <fieldset>
- <legend>3、点击文本框显示下拉列表</legend>
- <div class="selectSuggestion" id="suggestion3" keepDefaultStyle="true" showList="true"></div>
- <br/>
- 设置showList属性为true,点击文本框也会出现下拉列表。<br/>
- 当点击文本框出现下拉列表时,可以使用键盘操作进行翻页和选中。
- </fieldset>
- <div class="height_15"></div>
-
-
- <fieldset>
- <legend>4、不允许输入过滤</legend>
- <div class="selectSuggestion" id="suggestion4" keepDefaultStyle="true" suggestable="false" prompt="请选择" autoCheck="false" pageNum="50" openDirection="bottom"></div>
- <br/>
- 此时等同于基本的单选下拉框,并且这里自定义下拉列表每页50条记录,不足50条不出现分页按钮。
- </fieldset>
- <div class="height_15"></div>
-
- <fieldset>
- <legend>5、禁用/启用</legend>
- <div class="selectSuggestion" disabled="true" id="suggestion5" keepDefaultStyle="true"></div>
- <br/>
- <input type="button" value="启用" onclick="enableSelect()" style="width:105px;"/>
- <input type="button" value="禁用" onclick="disableSelect()" style="width:105px;"/>
- </fieldset>
- <div class="height_15"></div>
-
- <fieldset>
- <legend>6、选中事件</legend>
- <div class="selectSuggestion" id="suggestion6" keepDefaultStyle="true"></div>
- </fieldset>
- <div class="height_15"></div>
-
- <fieldset>
- <legend>7、宽度、高度与方向</legend>
- 下拉框默认有一个宽度(每种风格皮肤下默认宽度可能不一样),当有较长的选项时,下拉框宽度默认不变,而选项容器宽度自适应<br/>
- <div class="selectSuggestion" id="suggestion7-1" keepDefaultStyle="true"></div>
- <br/><br/>
- 单独设置下拉框宽度,选项容器宽度默认不会小于下拉框宽度<br/>
- <div class="selectSuggestion" id="suggestion7-2" keepDefaultStyle="true" selWidth="260"></div>
- <br/><br/>自定义容器高度:<br/>
- <div class="selectSuggestion" id="suggestion7-3" keepDefaultStyle="true" boxHeight="100"></div>
- <br/><br/>强制向上展开:<br/>
- <div class="selectSuggestion" id="suggestion7-4" keepDefaultStyle="true" openDirection="top"></div>
- </fieldset>
- <div class="height_15"></div>
-
- <fieldset>
- <legend>8、自定义下拉列表数据</legend>
- <div class="selectSuggestion" id="suggestion8" keepDefaultStyle="true"></div>
- <br/>
- 可以设置点击出现的下拉列表数据,例如当全部列表数据数据量很大时,点击下拉只显示推荐的数据。<br/>
- 当输入过滤时,再从全部的数据里面过滤。
- </fieldset>
- <div class="height_15"></div>
-
-
- <fieldset>
- <legend>9、自定义列数</legend>
- <div class="selectSuggestion" id="suggestion9" keepDefaultStyle="true" showMultiList="true" multiListWidth="300"></div>
- <br/>
- 设置showMultiList属性为true后,点击下拉的选项列表为多列。需要设置列表总宽度。<br/>
- 多列下拉列表无分页功能,并且需要设置列表的尺寸
- </fieldset>
- <div class="height_15"></div>
-
- <fieldset>
- <legend>10、选项标签式分组</legend>
- <div class="selectSuggestion" id="suggestion10" keepDefaultStyle="true" showMultiList="true" multiListWidth="300" multiListHeight="200"></div>
- <br/>
- 可以为组件多列下拉列表设置一个分组的数据,实现下拉列表的分组。
- </fieldset>
- <div class="height_15"></div>
-
-
- <fieldset>
- <legend>11、将下拉列表渲染为图片+文字</legend>
- <div class="selectSuggestion" id="suggestion11" renderMode="pic" boxWidth="330" keepDefaultStyle="true" itemHeight="90" itemWidth="75" pageNum="9"></div>
- </fieldset>
- <div class="height_15"></div>
-
- <fieldset>
- <legend>12、设置初始值</legend>
- <div class="selectSuggestion" id="suggestion12" keepDefaultStyle="true" selectedValue="4"></div>
- </fieldset>
- <div class="height_15"></div>
-
-
- <fieldset>
- <legend>13、取消自动验证</legend>
- <div class="selectSuggestion" id="suggestion13" keepDefaultStyle="true" autoCheck="false"></div>
- <input type="button" value="获取值" onclick="getValue2()" />
- <br/>
- 这时可以输入下拉列表没有的文本。
- </fieldset>
- <div class="height_15"></div>
-
-
- <fieldset>
- <legend>14、自定义验证</legend>
- <div class="selectSuggestion" id="suggestion14" keepDefaultStyle="true" autoCheck="false"></div>
- <br/>
- 通过自定义验证,可以用ajax方式将输入的值提交到后台检验数据库中是否存在该文本,如果存在,将对应的value返回通知页面是选择的;如果不存在,通知页面是输入的,提交时可以为选项表添加记录。<br/>
- </fieldset>
- <div class="height_15"></div>
-
- <fieldset>
- <legend>15、动态创建</legend>
- <input type="button" value="点击生成" id="testBtn" onclick="dynamic()" style="width:150px;"/>
- </fieldset>
- <div class="height_15"></div>
-
- <fieldset>
- <legend>16、获得选中节点自定义属性</legend>
- <div class="selectSuggestion" id="suggestion16" keepDefaultStyle="true" ></div>
- </fieldset>
- <div class="height_15"></div>
-
- <fieldset>
- <legend>17、无前缀数据</legend>
- <div class="selectSuggestion" id="suggestion17" keepDefaultStyle="true" showMultiList="true" multiListWidth="300" multiListHeight="200"></div>
- </fieldset>
- <div class="height_50"></div>
-
-
-
-
- <script>
- var listdata={"list":[
- {value:"1",key:"北京",suggest:"北京|beijing|bj"},
- {value:"2",key:"广州",suggest:"广州|guangzhou|gz"},
- {value:"3",key:"深圳",suggest:"深圳|shenzhen|sz"},
- {value:"4",key:"上海",suggest:"上海|shanghai|sh"},
- {value:"5",key:"长沙",suggest:"长沙|changsha|cs"},
- {value:"6",key:"成都",suggest:"成都|chengdu|cd"},
- {value:"7",key:"贵阳",suggest:"贵阳|guiyang|gy"},
- {value:"8",key:"海口",suggest:"海口|haikou|hk"},
- {value:"9",key:"杭州",suggest:"杭州|hangzhou|hz"},
- {value:"10",key:"昆明",suggest:"昆明|kunming|km"},
- {value:"11",key:"南昌",suggest:"南昌|nanchang|nc"},
- {value:"12",key:"南京",suggest:"南京|nanjing|nj"},
- {value:"13",key:"三亚",suggest:"三亚|sanya|sy"},
- {value:"14",key:"沈阳",suggest:"沈阳|shenyang|sy"},
- {value:"15",key:"温州",suggest:"温州|wenzhou|wz"},
- {value:"16",key:"武汉",suggest:"武汉|wuhan|wh"},
- {value:"17",key:"厦门",suggest:"厦门|xiamen|xm"},
- {value:"18",key:"西安",suggest:"西安|xian|xa"},
- {value:"19",key:"郑州",suggest:"郑州|zhenghou|zz"},
- {value:"20",key:"汕头",suggest:"汕头|shantou|st"},
- {value:"21",key:"太原",suggest:"太原|taiyuan|ty"},
- {value:"22",key:"天津",suggest:"天津|tianjin|tj"}]};
- var hotdata={"list":[
- {value:"1",key:"北京"},
- {value:"2",key:"广州"},
- {value:"3",key:"深圳"},
- {value:"4",key:"上海"}]};
- var tabdata={list:[
- {name:"热门城市",tab:[
- {key:"北京",value:"1"},
- {key:"广州",value:"2"},
- {key:"深圳",value:"3"},
- {key:"上海",value:"4"},
- {key:"成都",value:"6"},
- {key:"杭州",value:"9"},
- {key:"三亚",value:"13"},
- {key:"天津",value:"22"},
- {key:"厦门",value:"17"},
- {key:"西安",value:"18"}
- ]},
- {name:"A-F",tab:[
- {key:"北京",value:"1"},
- {key:"长沙",value:"5"},
- {key:"成都",value:"6"}
- ]},
- {name:"G-J",tab:[
- {key:"广州",value:"2"},
- {key:"贵阳",value:"7"},
- {key:"海口",value:"8"},
- {key:"杭州",value:"9"}
- ]},
- {name:"K-N",tab:[
- {key:"昆明",value:"10"},
- {key:"南昌",value:"11"},
- {key:"南京",value:"12"}
- ]},
- {name:"O-T",tab:[
- {key:"深圳",value:"3"},
- {key:"上海",value:"4"},
- {key:"三亚",value:"13"},
- {key:"沈阳",value:"14"},
- {key:"汕头",value:"20"},
- {key:"太原",value:"21"},
- {key:"天津",value:"22"}
- ]},
- {name:"U-Z",tab:[
- {key:"温州",value:"15"},
- {key:"武汉",value:"16"},
- {key:"厦门",value:"17"},
- {key:"西安",value:"18"},
- {key:"郑州",value:"19"}
- ]}
- ]}
- var listdata2=[
- {value:"1",key:"北京",suggest:"北京|beijing|bj"},
- {value:"2",key:"广州",suggest:"广州|guangzhou|gz"},
- {value:"3",key:"深圳",suggest:"深圳|shenzhen|sz"},
- {value:"4",key:"上海",suggest:"上海|shanghai|sh"},
- {value:"5",key:"长沙",suggest:"长沙|changsha|cs"},
- {value:"6",key:"成都",suggest:"成都|chengdu|cd"},
- {value:"7",key:"贵阳",suggest:"贵阳|guiyang|gy"},
- {value:"8",key:"海口",suggest:"海口|haikou|hk"},
- {value:"9",key:"杭州",suggest:"杭州|hangzhou|hz"},
- {value:"10",key:"昆明",suggest:"昆明|kunming|km"},
- {value:"11",key:"南昌",suggest:"南昌|nanchang|nc"},
- {value:"12",key:"南京",suggest:"南京|nanjing|nj"},
- {value:"13",key:"三亚",suggest:"三亚|sanya|sy"},
- {value:"14",key:"沈阳",suggest:"沈阳|shenyang|sy"},
- {value:"15",key:"温州",suggest:"温州|wenzhou|wz"},
- {value:"16",key:"武汉",suggest:"武汉|wuhan|wh"},
- {value:"17",key:"厦门",suggest:"厦门|xiamen|xm"},
- {value:"18",key:"西安",suggest:"西安|xian|xa"},
- {value:"19",key:"郑州",suggest:"郑州|zhenghou|zz"},
- {value:"20",key:"汕头",suggest:"汕头|shantou|st"},
- {value:"21",key:"太原",suggest:"太原|taiyuan|ty"},
- {value:"22",key:"天津",suggest:"天津|tianjin|tj"}];
- var tabdata2=[
- {name:"热门城市",tab:[
- {key:"北京",value:"1"},
- {key:"广州",value:"2"},
- {key:"深圳",value:"3"},
- {key:"上海",value:"4"},
- {key:"成都",value:"6"},
- {key:"杭州",value:"9"},
- {key:"三亚",value:"13"},
- {key:"天津",value:"22"},
- {key:"厦门",value:"17"},
- {key:"西安",value:"18"}
- ]},
- {name:"A-F",tab:[
- {key:"北京",value:"1"},
- {key:"长沙",value:"5"},
- {key:"成都",value:"6"}
- ]},
- {name:"G-J",tab:[
- {key:"广州",value:"2"},
- {key:"贵阳",value:"7"},
- {key:"海口",value:"8"},
- {key:"杭州",value:"9"}
- ]},
- {name:"K-N",tab:[
- {key:"昆明",value:"10"},
- {key:"南昌",value:"11"},
- {key:"南京",value:"12"}
- ]},
- {name:"O-T",tab:[
- {key:"深圳",value:"3"},
- {key:"上海",value:"4"},
- {key:"三亚",value:"13"},
- {key:"沈阳",value:"14"},
- {key:"汕头",value:"20"},
- {key:"太原",value:"21"},
- {key:"天津",value:"22"}
- ]},
- {name:"U-Z",tab:[
- {key:"温州",value:"15"},
- {key:"武汉",value:"16"},
- {key:"厦门",value:"17"},
- {key:"西安",value:"18"},
- {key:"郑州",value:"19"}
- ]}
- ]
- var listdata3={"list":[
- {value:"1",key:"北京市海淀区北四环西路9号银谷大厦8层",suggest:"北京|beijing|bj"},
- {value:"2",key:"广州市西路9号银谷大厦8层",suggest:"广州|guangzhou|gz"},
- {value:"3",key:"深圳市西路9号银谷大厦8层",suggest:"深圳|shenzhen|sz"},
- {value:"4",key:"上海市西路9号银谷大厦8层",suggest:"上海|shanghai|sh"},
- {value:"5",key:"长沙市西路9号银谷大厦8层",suggest:"长沙|changsha|cs"}]};
- var listdata4={"list":[
- {value:"1",key:"北京",suggest:"北京|beijing|bj",custom:"北京自定义属性"},
- {value:"2",key:"广州",suggest:"广州|guangzhou|gz",custom:"广州自定义属性"},
- {value:"3",key:"深圳",suggest:"深圳|shenzhen|sz",custom:"深圳自定义属性"}]};
- var listdata5={"list":[
- {value:"1",key:"北京",suggest:"北京|beijing|bj",img:"../../libs/icons/png_64/11.png"},
- {value:"2",key:"广州",suggest:"广州|guangzhou|gz",img:"../../libs/icons/png_64/12.png"},
- {value:"3",key:"深圳",suggest:"深圳|shenzhen|sz",img:"../../libs/icons/png_64/13.png"},
- {value:"4",key:"上海",suggest:"上海|shanghai|sh",img:"../../libs/icons/png_64/14.png"},
- {value:"5",key:"长沙",suggest:"长沙|changsha|cs",img:"../../libs/icons/png_64/15.png"},
- {value:"6",key:"成都",suggest:"成都|chengdu|cd",img:"../../libs/icons/png_64/16.png"},
- {value:"7",key:"贵阳",suggest:"贵阳|guiyang|gy",img:"../../libs/icons/png_64/17.png"},
- {value:"8",key:"海口",suggest:"海口|haikou|hk",img:"../../libs/icons/png_64/18.png"},
- {value:"9",key:"杭州",suggest:"杭州|hangzhou|hz",img:"../../libs/icons/png_64/19.png"},
- {value:"10",key:"昆明",suggest:"昆明|kunming|km",img:"../../libs/icons/png_64/20.png"},
- {value:"11",key:"南昌",suggest:"南昌|nanchang|nc",img:"../../libs/icons/png_64/21.png"},
- {value:"12",key:"南京",suggest:"南京|nanjing|nj",img:"../../libs/icons/png_64/22.png"},
- {value:"13",key:"三亚",suggest:"三亚|sanya|sy",img:"../../libs/icons/png_64/23.png"},
- {value:"14",key:"沈阳",suggest:"沈阳|shenyang|sy",img:"../../libs/icons/png_64/24.png"},
- {value:"15",key:"温州",suggest:"温州|wenzhou|wz",img:"../../libs/icons/png_64/25.png"},
- {value:"16",key:"武汉",suggest:"武汉|wuhan|wh",img:"../../libs/icons/png_64/26.png"},
- {value:"17",key:"厦门",suggest:"厦门|xiamen|xm",img:"../../libs/icons/png_64/27.png"},
- {value:"18",key:"西安",suggest:"西安|xian|xa",img:"../../libs/icons/png_64/28.png"},
- {value:"19",key:"郑州",suggest:"郑州|zhenghou|zz",img:"../../libs/icons/png_64/29.png"},
- {value:"20",key:"汕头",suggest:"汕头|shantou|st",img:"../../libs/icons/png_64/30.png"},
- {value:"21",key:"太原",suggest:"太原|taiyuan|ty",img:"../../libs/icons/png_64/31.png"},
- {value:"22",key:"天津",suggest:"天津|tianjin|tj",img:"../../libs/icons/png_64/32.png"}]};
- function initComplete(){
- $("#suggestion2").data("data",listdata);
- $("#suggestion2").render();
- $("#suggestion3").data("data",listdata);
- $("#suggestion3").render();
-
- $("#suggestion4").data("data",listdata);
- $("#suggestion4").render();
-
- $("#suggestion5").data("data",listdata);
- $("#suggestion5").render();
-
- $("#suggestion6").data("data",listdata);
- $("#suggestion6").render();
- $("#suggestion6").bind("listSelect",function(e,obj){
- top.Dialog.alert("选中项文本:"+obj.relText+";选中项值:"+obj.relValue);
- })
-
- $("#suggestion7-1").data("data",listdata3);
- $("#suggestion7-1").render();
-
- $("#suggestion7-2").data("data",listdata3);
- $("#suggestion7-2").render();
-
- $("#suggestion7-3").data("data",listdata);
- $("#suggestion7-3").render();
-
- $("#suggestion7-4").data("data",listdata);
- $("#suggestion7-4").render();
-
- $("#suggestion8").data("data",listdata);
- $("#suggestion8").data("list",hotdata);
- $("#suggestion8").render();
-
- $("#suggestion9").data("data",listdata);
- $("#suggestion9").render();
-
- $("#suggestion10").data("data",listdata);
- $("#suggestion10").data("tab",tabdata);
- $("#suggestion10").render();
-
- $("#suggestion11").data("data",listdata5);
- $("#suggestion11").selectSuggestionRender();
-
- $("#suggestion12").data("data",listdata);
- $("#suggestion12").render();
-
- $("#suggestion13").data("data",listdata);
- $("#suggestion13").render();
-
- $("#suggestion14").data("data",listdata);
- $("#suggestion14").render();
- $("#suggestion14").bind("validate",function(e,value){
- top.Dialog.alert("此处触发验证事件,可以用ajax方式将”"+value+"“提交到后台处理。")
- })
-
- $("#suggestion16").data("data",listdata4);
- $("#suggestion16").render();
- $("#suggestion16").bind("listSelect",function(e,obj){
- var node=$("#suggestion16").data("selectedNode");
- top.Dialog.alert(node.custom);
- })
-
- $("#suggestion17").data("data",listdata2);
- $("#suggestion17").data("tab",tabdata2);
- $("#suggestion17").render();
-
-
-
- }
- function getValue(){
- top.Dialog.alert("选中文本:"+$("#sug-1").attr("relText")+"<br/>选中值:"+$("#sug-1").attr("relValue"));
- }
- function getValue2(){
- top.Dialog.alert("输入文本:"+$("#suggestion13").attr("relText"));
- }
- //设为不可用
- function disableSelect(){
- $("#suggestion5").attr("disabled",true);
- $("#suggestion5").render();
- }
- //设为可用
- function enableSelect(){
- $("#suggestion5").attr("disabled",false);
- $("#suggestion5").render();
- }
- //动态生成
- function dynamic(){
- var $sugg = $('<div type="text" class="selectSuggestion"></div>');
- $sugg.data("data",listdata);
- $("#testBtn").after($sugg);
- $("#testBtn").after($("<br/>"));
- //渲染
- $sugg.render();
- }
- </script>
- </body>
- </html>
|