Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

jQuery EasyUI Basic Plugins - Searchbox

jQuery EasyUI Basic Plugins - Searchbox


jQuery EasyUI Plugins jQuery EasyUI Plugins


Override the default defaults through $.fn.searchbox.defaults.

A searchbox prompts the user to enter a search value. It can be combined with a menu that allows the user to select different search categories. When the user presses the ENTER key or clicks the search button on the right side of the component, the search action will be performed.

Depends on

Usage

Creating a Searchbox

1. Create from markup. Add the 'easyui-searchbox' class to the tag.







All News
Sports News

2. Create programmatically.





All News
Sports News


$('#ss').searchbox({

    searcher:function(value,name){

    alert(value + "," + name)

    },

    menu:'#mm',

    prompt:'Please Input Value'

});

property

Name Type Description Default value
width number The width of the component. auto
height number The height of the component. This property is available since version 1.3.2. 22
prompt string The prompt message displayed in the input box. ''
value string The input value. ''
menu selector The menu of search types. Each menu item can have the following properties:
 name:搜索类型名称。       

 selected:当前选择的搜索类型名称。       

   

 下面的实例演示了如何定义一个选中的搜索类型名称。     

    
Search Item1
    
Search Item2
    
Search Item3
| null| onSelect | event | searcher | function(value,name) | The searcher function is called when the user presses the search button or the ENTER key. | null |

Method

Name Parameters Description
options none Return the options object.
menu none Returns the menu object of the search type.
 下面of实例演示如何改变菜单项图标。     

var m = $('#ss').searchbox('menu'); // get the menu object var item = m.menu('findItem', 'Sports News'); // find the menu item // change the menu item icon m.menu('setIcon', {     target: item.target,     iconCls: 'icon-save' }); // select the searching type name $('#ss').searchbox('selectName', 'sports');| onSelect | event | textbox | none | Return the textbox object.| onSelect | event | getValue | none | Return the current search value.| onSelect | event | setValue | value | Set a new search value.| onSelect | event | getName | none | Return the current search type name.| onSelect | event | selectName | name | Select the current search type name.
Code example:

$('#ss').searchbox('selectName', 'sports');

| onSelect | event | destroy | none | Destroy the component.| onSelect | event | resize | width | Reset the component's width. |


jQuery EasyUI Plugins jQuery EasyUI Plugins