struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fea jabi <zy...@hotmail.com>
Subject RE: <sj:autocompleter> dependable
Date Thu, 27 Aug 2015 02:07:57 GMT
Thanks, for trying to help me on this. I did add the subscribe java script functions as you've
suggested. Still not working. Please need help.
 
		<sj:autocompleter

id="publisherNameId"

name="publisherName"

list="%{publishers}"

listValue="name"

listKey="code"

listLabel="code"

selectBox="true"

selectBoxIcon="true"

key="label.publisherName"

onChangeTopics="autocompleteChange"

onFocusTopics="autocompleteFocus"

onSelectTopics="autocompleteSelect"

size="34"

maxlength="34"

/>


		<sj:autocompleter

id="publisherCodeId"

name="publisherCode"

list="%{publishers}"

listValue="code"

listKey="name"

selectBox="true"

selectBoxIcon="true"

key="label.publisherCode"

size="20"	

maxlength="20"

onChangeTopics="autocompleteChange"

onFocusTopics="autocompleteFocus"

onSelectTopics="autocompleteSelect"	

/>


<script type="text/javascript" >

$(document).ready(function() {



$.subscribe('autocompleteChange', function(event, data) {

var ui = event.originalEvent.ui;

var message = ui.item.value;

if(ui.item.key) {

message = '( '+ ui.item.key +' ) '+message;
}
$('#topics').html('<b>'+message+'</b>');
});


$.subscribe('autocompleteFocus', function(event, data) {

var ui = event.originalEvent.ui;

var message = ui.item.value;

if(ui.item.key) {

message = '( '+ ui.item.key +' ) '+message;

}
$('#topics').html('<u>'+message+'</u>');
});



  $.subscribe('autocompleteSelect', function(event, data) {
var ui = event.originalEvent.ui;

var message = ui.item.value;
if(ui.item.key) {

message = '( '+ ui.item.key +' ) '+message;
}
$('#topics').html('<i>'+message+'</i>');
});

});	
</script>
 

 
> From: mgainty@hotmail.com
> To: user@struts.apache.org
> Subject: RE: <sj:autocompleter> dependable
> Date: Wed, 26 Aug 2015 20:36:27 -0400
> 
> MG>follow the example to the letter
> 
> 
> > From: zyxrm@hotmail.com
> > To: user@struts.apache.org
> > Subject: RE: <sj:autocompleter> dependable
> > Date: Wed, 26 Aug 2015 13:21:13 -0400
> > 
> > I tried doing this  onSelectTopics of first autocompleter to select value of the
second autocompleter but didn't work. Any suggessions?
> >  
> > First autocompleter
> > <sj:autocompleter
> > ........
> > onChangeTopics="publisherDescChange"
> > onSelectTopics="publisherDescSelect"                      
> > .....
> > />
> >  
> MG> <!-- handle publisherDescChange first with subscribe statement below -->
> $.subscribe('publisherDescChange', function(event, data) {
>   	var ui = event.originalEvent.ui;
>   	var message = ui.item.value;
>   	if(ui.item.key) {
>   		message = '( '+ ui.item.key +' ) '+message;
>   	}
> 		$('#topics').html('<b>'+message+'</b>');
> 	});>  
> MG>
> 
> MG><!-- handle publisherDescSelect  with subscribe statement below -->
> $.subscribe('publisherDescSelect', function(event, data) {
>   	var ui = event.originalEvent.ui;
>   	var message = ui.item.value;
>   	if(ui.item.key) {
>   		message = '( '+ ui.item.key +' ) '+message;
>   	}
> 		$('#topics').html('<i>'+message+'</i>');
> 	});
> MG>
> 
> http://struts.jgeppert.com/struts2-jquery-showcase/autocompleter-json.action;jsessionid=CE13A626C1A38AC66A47344D139993DE
> 
> MG>Now when you select the list is the javascript function for second subscribe('publisherDescSelect'
... called ?
> MG>Now when you change the list is the javascript function for first subscribe('publisherDescChange'
... called ?
> MG>its important you implement everything you see in the autocompleter example
> MG>if you do not your results will be 'undefined'
> >  
> > > From: zyxrm@hotmail.com
> > > To: user@struts.apache.org
> > > Subject: RE: <sj:autocompleter> dependable
> > > Date: Wed, 26 Aug 2015 09:55:53 -0400
> > > 
> > > As mentioned earlier have 2 autocompleters with same list of Managers. Only
difference being the Manger.description is shown as drop down in one and Manager.code is shown
in the drop down in another. 
> > > 
> > > 
> > > In the first autocompleter when Manager.description is selected it should automatically
select the second autocompleter with corresponding Manager.code value and vise versa.
> > > 
> > > 
> > > How to do this?
> > > 
> > > 
> > >  I am new to both struts2 and jquery. Please need help with this.
> > >  
> > > I tried adding the subscribe mentioned below that didn't auto select the option
in the second autocompleter.
> > > 
> > >  
> > > > From: mgainty@hotmail.com
> > > > To: user@struts.apache.org
> > > > Subject: RE: <sj:autocompleter> dependable
> > > > Date: Tue, 25 Aug 2015 07:09:12 -0400
> > > > 
> > > > you will notice in the autocompleter tutorial posted at 
> > > > http://struts.jgeppert.com/struts2-jquery-showcase/autocompleter-json.action;jsessionid=CE13A626C1A38AC66A47344D139993DE
> > > > 
> > > > there exists a <sj:autocompleter with 
> > > > onChangeTopics="autocompleteChange"but there is no (jquery) function subscribed
to listen to autocompleteChange topic ..
> > > > if you look at bottom of tutorial you will see:
> > > > $.subscribe('autocompleteChange', function(event, data) {
> > > >   	var ui = event.originalEvent.ui;
> > > >   	var message = ui.item.value;
> > > >   	if(ui.item.key) {
> > > >   		message = '( '+ ui.item.key +' ) '+message;
> > > >   	}
> > > > 		$('#topics').html('<b>'+message+'</b>');
> > > > 	});
> > > > 
> > > > when you publish an event topic you will also need to subscribe listener
for the same event topic
> > > > HTH
> > > > Martin
> > > > 
> > > > > From: zyxrm@hotmail.com
> > > > > To: user@struts.apache.org
> > > > > Subject: <sj:autocompleter> dependable
> > > > > Date: Mon, 24 Aug 2015 15:59:49 -0400
> > > > > 
> > > > >  I am new to struts2 and need help with the struts2 jquery autocompleter
tag
> > > > >  
> > > > > 
> > > > > 
> > > > > Have an object 
> > > > > 
> > > > > Publisher
> > > > > 
> > > > > code
> > > > > 
> > > > > description
> > > > >  
> > > > >  
> > > > > 
> > > > > 
> > > > > In Action
> > > > > 
> > > > > getPublishers()
> > > > >  
> > > > > 
> > > > > 
> > > > > I am trying to use 2 dependable sj:autocompleter tags. In both it
should display the Publishers list but
> > > > > 
> > > > >  in one it should display the description of publisher and in another
it should display the code
> > > > > 
> > > > > 
> > > > > If the user changes discription in one of the autocompleter then
it should change the code and vise versa on the second autocompleter.
> > > > >  
> > > > > 
> > > > > 
> > > > > I am not not sure how the selected value goes to the action class.
I'll want the selected publisher to be set to corresponding Publisher object selected to the
selectedPublisherOfPublisherDescription attribute. 
> > > > >  
> > > > > 
> > > > > How will it change the second autocompleter code on change of the
first one. But, it's not working. Your help is appreciated.
> > > > >  
> > > > > 
> > > > > I tried the below
> > > > > 
> > > > > 		<sj:autocompleter
> > > > > 
> > > > > 				id="publisherDescriptionId"
> > > > > 
> > > > > 				name="publisherDescription"
> > > > > 
> > > > > 				value="%{selectedPublisherOfPublisherDescription}"
> > > > > 
> > > > > 				list="%{publishers}"
> > > > > 
> > > > > 				listValue="description"
> > > > > 
> > > > > 				listKey="code"
> > > > > 
> > > > > 				selectBox="true"
> > > > > 
> > > > > 				selectBoxIcon="true"
> > > > > 
> > > > > 				label="Publisher Description"
> > > > > 
> > > > > 				onChangeTopics="publisherChange"
> > > > > 
> > > > > 		     />
> > > > > 
> > > > > 		     
> > > > > 
> > > > > 		<sj:autocompleter
> > > > > 
> > > > > 				id="publisherCodeId"
> > > > > 
> > > > > 				name="publisherCode"
> > > > > 
> > > > > 				value="%{selectedPublisherOfMPublisherCode}"
> > > > > 
> > > > > 				list="%{publishers}"
> > > > > 
> > > > > 				listValue="code"
> > > > > 
> > > > > 				listKey="description"
> > > > > 
> > > > > 				selectBox="true"
> > > > > 
> > > > > 				selectBoxIcon="true"
> > > > > 
> > > > > 				label="Publisher Code"
> > > > > 
> > > > > 				listenTopics="publisherChange"
> > > > >  		 	   		  
> > > >  		 	   		  
> > >  		 	   		  
> >  		 	   		  
>  		 	   		  
 		 	   		  
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message