ãjQueryãã©ã°ã¤ã³ã jquery.ajaxSuggest.js ãå ¬éãã¾ããã
â» æ´æ°çµäº
ajaxComboBoxã¸åæµãã¾ããã
Updating is closed.
This plugin was unified with "jquery.ajaxComboBox".
jquery.ajaxComboBox
simple mode: http://www.usamimi.info/~sutara/ajaxComboBox/#sample07
- Latest version : 1.5.4 (2012/02/10)
- jQuery 1.7以éã§åä½ãã¾ã
ç®æ¬¡ (Contents)
- â ãã¢ããã¦ã³ãã¼ã (Demo, Download)
- â ç¹å¾´
- â è¨ç½®æ¹æ³
- â ãªãã·ã§ã³
- â æ´æ°å±¥æ´
ãã¢ããã¦ã³ãã¼ã (Demo, Download)
ãã㢠(Demo)ã
ããã¦ã³ãã¼ã (Download)ã
ç¹å¾´
ãªãã®å¤å²ããªãããªã¼ãã³ã³ããªã¼ãããã¹ãããã¯ã¹ã§ãããã ãæ¥æ¬èªã®æ¤ç´¢ã«ãå®å ¨ã«å¯¾å¿ãã¦ãã¾ãã
ãªããAjaxã§DBã«åãåãã¦äºæ¸¬åè£ãæ¤ç´¢ããæ¹å¼ã«ç¹åãã¦ãã¾ãã
â²ã·ã³ãã«ãªåè£ãªã¹ã表示
â²å²©æçã®ãµãæ
å ±(ver 1.5ã)
ãå ã«ãªã£ããã©ã°ã¤ã³ (Based-on)ã
ãã®ãã©ã°ã¤ã³ã¯ãPeter Vulgarisãããä½æãããjquery.suggest 1.1ããæ¹é ãããã®ã§ãã
ãåä½ç¢ºèªã
- GoogleChrome 15.0
- Firefox 8.0
- Opera 11.52
- InternetExplorer 9
- Safari 5.1.1
ãã©ã¤ã»ã³ã¹(License)ã
MIT License
è¨ç½®æ¹æ³
â»CakePHPã§å©ç¨ããã«ã¯ãä¸è¨ãåèã«ãã¦ãã ãããhttp://d.hatena.ne.jp/sutara_lumpur/20100721/1279676671
=>HTML
â»ããã¹ãããã¯ã¹ã«å¯¾ãã¦æå®ãã¦ãã ããã
Javascript:
jQuery(document.body).ready(function($){//ãã£ã¨ãåç´ãªå½¢å¼ã§è¨ç½®
$('#input_suggest').ajaxSuggest('hoge.php');});
HTML:
<input type="text" id="input_suggest">
以ä¸ã®ããã«åºåããã¾ãã
// (1) ããã¹ãããã¯ã¹
<input id="input_suggest" autocomplete="off" class="as_input">// (2) åè£ãªã¹ã
<ul class="as_results">
<li>Jamaica</li>
<li class="as_over">Japan</li>
<li>Jordan</li>
<li>Azerbaijan</li>
<li>Tajikistan</li>
<li>Fiji</li>
</ul>
ãªãã·ã§ã³
第2å¼æ°ã«ãJSONå½¢å¼ã§ãªãã·ã§ã³ãæå®ã§ãã¾ãã
$('#input_suggest').ajaxSuggest(
'hoge.php',
{
'database':2,
'per_page':20
}
);
éä¿¡å (ajaxSuggest.php)
$db_settings = array(
array('table'=>'prefectures', 'field'=>'name', 'order'=>'id'), //0
array('table'=>'users_ja', 'field'=>'name', 'order'=>'id'), //1
array('table'=>'nations', 'field'=>'name', 'order'=>'id'), //2
array('table'=>'users_en', 'field'=>'name', 'order'=>'id') //3
);
ãªãã·ã§ã³å | 説æ | åæå¤ |
---|---|---|
database | æ¥ç¶ããDBãã¼ãã«ãæå®ã ãããããç¨æãã¦ãããã¼ãã«æ å ±ãåããé åã®çªå·ãæå®ã ãªãã"field"ã¨"order"ãã£ã¼ã«ããåãå ´åã"order"ã®è¨è¿°ãçç¥ã§ããã |
0 è¤æ°æå®ã®å ´å '0 1 2' |
limit | åè£ãªã¹ãã¨ãã¦è¡¨ç¤ºããæå¤§ä»¶æ° | 10 |
and_or | 空ç½ã§åºåãããåèªããANDæ¤ç´¢ããããORæ¤ç´¢ããã ã使ãæ¹ã |
AND |
order_by | ORDER BY(SQL) ã§ã並ãæ¿ããã®ã¯æé ãéé ã | 'ASC' |
bind_to | åè£é¸æå¾ã«çºç«ããã¤ãã³ãå | 'ajaxSuggest_selected' |
results_class | åè£ãªã¹ãã®CSSã¯ã©ã¹å | 'as_results' / 'as_results_mini' |
select_class | é¸æä¸ã®<li>ã¿ã°ã®CSSã¯ã©ã¹å | 'as_overs' / 'as_over_mini' |
æ´æ°å±¥æ´
- 1.5.3ã®æ´æ°å 容
- 1.5.1ã®æ´æ°å 容
- 1.3.1ã®æ´æ°å 容
- 1.2.2ã®æ´æ°å 容
- 1.2.1ã®æ´æ°å 容
- 1.2ã®æ´æ°å 容
- 1.1.1ã®æ´æ°å 容
- 1.1ã®æ´æ°å 容
- 1.0.1ã®æ´æ°å 容