javascript - How to reload the struts2-jquery autocompleter X with value selected from another struts2-jquery autocompleter Y -


i have 2 strut2 jquery autocompleter box called x,y in jsp page. if change x , automatically y should change according selected value of x.in struts dojo tags used listen topics reload . strut2 jquery not able reload .

my code

             <sj:autocompleter                 id="mapnamelist"                 name="map_name"                 list="%{mapnamelist}"                 selectbox="true"                 selectboxicon="true"                 onchangetopics="autocompletechange"                 onfocustopics="autocompletefocus"                 onselecttopics="autocompleteselect"                 />         <label for="map_type">maptype: </label>             <sj:autocompleter                 id="maptypelist"                 name="map_type"                 list="%{maptypelist}"                 selectbox="true"                 selectboxicon="true"                 onchangetopics="autocompletechange"                 onfocustopics="autocompletefocus"                 onselecttopics="autocompleteselect"                 /> 

if prefer json autocompleter list 1 can :

define onselecttopics of first on specific value

onselecttopics="/mapnamelistchange" 

define second

listentopics="/mapnamelistchange" 

create function :

$.subscribe("/mapnamelistchange",function(event, data){             //clear children autocompleters             jquery('#maptypelist').val("");             jquery('#maptypelist_widget').val("");             var ui = event.originalevent.ui;             if (ui.item && ui.item.value.length > 0) {                 setjqueryautocompleterurl(jquery('#maptypelist_widget'),"your json request", "extraparameter=" + ui.item.value, "the list used in json", "maptypelist", "map_type", "/mapnamelistchange", "/maptypelistchange");             };         },null); 

where setjqueryautocompleterurl function

function setjqueryautocompleterurl(widget,href, hrefparameter, list, id, name, selecttopics, listentopics) {          var options_auto_iban_widget = {};         options_auto_iban_widget.hiddenid = "maptypelist";         options_auto_iban_widget.selectbox = true;             options_auto_iban_widget.selectboxicon= true;         options_auto_iban_widget.forcevalidoption = true;         options_auto_iban_widget.onselecttopics = "/autodebtoribanchange";         options_auto_iban_widget.list = list;         options_auto_iban_widget.listkey = "id";         options_auto_iban_widget.listvalue = "name";         options_auto_iban_widget.jqueryaction = "autocompleter";         options_auto_iban_widget.id = id;         options_auto_iban_widget.name = name + "_widget";         options_auto_iban_widget.href = href+"?"+hrefparameter;         options_auto_iban_widget.listentopics = "/autodebtorbicchange";          jquery.struts2_jquery_ui.bind(widget,options_auto_iban_widget);     } 

then have extraparameter param of json call filter result.


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -