EasyUI Forum
April 30, 2024, 10:33:45 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: dynamic menu in searchbox ?  (Read 2619 times)
Coder
Jr. Member
**
Posts: 96


View Profile
« on: October 22, 2020, 06:32:52 PM »

combo wrong Sad
Code:
  <input id="sb" class="easyui-searchbox" style="width:300px"
    data-options="searcher:doSearch
                , prompt:'Search'
                , menu: '#cb'
                "
  >
  <input id="cb" class="easyui-combobox"
    data-options="valueField:'MID'
                , textField:'Name'
                , url: apiPath
                "
  >

datalist wrong Sad
Code:
 
  <input id="sb" class="easyui-searchbox" style="width:300px"
    data-options="searcher:doSearch
                , prompt:'Search'
                , menu: '#cld'
                "
  >
 <div id="cld" class="easyui-datalist"
    data-options="valueField:'MID'
                , textField:'Name'
                , checkbox: false
                , lines: true
                , url:apiPath
                "
  >
  </div>
OR

how to create menu for searchbox based on remote server data ?
Logged
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #1 on: October 25, 2020, 08:35:45 PM »

Please try this code.
Code:
var mm = $('<div></div>').menu();
mm.menu('appendItem', {
text: 'All News',
name: 'all'
})
mm.menu('appendItem', {
text: 'Sports News',
name: 'sports'
})
$("#sb").searchbox({
menu: mm
})
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!