Rocking
asked on
set default value in multivalue combo
Hi,
I want to display multicolumn combo box in the html file for which i am using jquery.multicolselect.js.
The problem i am facing is i want to set the default value (can be any of the given below) to be displayed in the mulitcombo.
Thanks in advance.
Source code of the jsp file is given below
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<script type="text/javascript"
src="//ajax.googleapis.com /ajax/libs /jquery/1. 9.0/jquery .min.js">< /script>
<script type="text/javascript"
src="${pageContext.request .contextPa th}/resour ces/js/mul tiselectco mbo/jquery .multicols elect.js"> </script>
</script>
</head>
<script language="javascript" type="text/javascript">
jQuery(document)
.ready(
function() {
$("#datatable")
.multicolselect(
{
buttonImage : "${pageContext.request.con textPath}/ resources/ images/sel ectbutton. gif",
valueCol : 1,
hideCol : 0
});
});
</script>
<body>
<form>
<div>
<!-- Controlling the multicombo value scroll,height,width -->
<div id="datatable"
style="overflow-y: auto; overflow-x: auto; height: 80px; width: 850px">
<%%>
<table border="1" cellspacing="0" width="100%">
<tr>
<td>1</td>
<td>1</td>
<td>A1</td>
</tr>
<tr>
<td>2</td>
<td>2</td>
<td>A2</td>
</tr>
<tr>
<td>3</td>
<td>3</td>
<td>A3</td>
</tr>
</table>
</div>
</div>
</form>
</body>
</html>
jquery.multicolselect.js
I want to display multicolumn combo box in the html file for which i am using jquery.multicolselect.js.
The problem i am facing is i want to set the default value (can be any of the given below) to be displayed in the mulitcombo.
Thanks in advance.
Source code of the jsp file is given below
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<script type="text/javascript"
src="//ajax.googleapis.com
<script type="text/javascript"
src="${pageContext.request
</script>
</head>
<script language="javascript" type="text/javascript">
jQuery(document)
.ready(
function() {
$("#datatable")
.multicolselect(
{
buttonImage : "${pageContext.request.con
valueCol : 1,
hideCol : 0
});
});
</script>
<body>
<form>
<div>
<!-- Controlling the multicombo value scroll,height,width -->
<div id="datatable"
style="overflow-y: auto; overflow-x: auto; height: 80px; width: 850px">
<%%>
<table border="1" cellspacing="0" width="100%">
<tr>
<td>1</td>
<td>1</td>
<td>A1</td>
</tr>
<tr>
<td>2</td>
<td>2</td>
<td>A2</td>
</tr>
<tr>
<td>3</td>
<td>3</td>
<td>A3</td>
</tr>
</table>
</div>
</div>
</form>
</body>
</html>
jquery.multicolselect.js
Do you have a link to the documentation of that select?
your not even mention that select box in your html code
It's a widget
ASKER
Do you have a link to the documentation of that select?
http://code.google.com/p/jquerymulticolumnselectbox/
http://code.google.com/p/jquerymulticolumnselectbox/
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Post a request here
http://multicolselect.blogspot.nl/
and the author might just create a command for it
http://multicolselect.blogspot.nl/
and the author might just create a command for it
ASKER
@leakim971
I tried with the below code but not able to set the default value in the multi select combo box
$("#datatable").find("tr:e q(1)").cli ck();
By default i want the first record to be displayed in the multi combo box?
I tried with the below code but not able to set the default value in the multi select combo box
$("#datatable").find("tr:e
By default i want the first record to be displayed in the multi combo box?
post a link to your page.
It work fine in the jsfiddle
It work fine in the jsfiddle
remove the space between e and q
$("#datatable").find("tr:eq(1)").click();
ASKER
It's (Default value is set) working now.
There is one problem that if we click on the browser or any other text box on the html page the div (datatable) remains open.It closes only when clicked in the table.
Since i am making mulitselect combo,if u can provide some help on the above also as how to close if user click on anywhere on the screen i.e functionality like a select box in html
Thanks
There is one problem that if we click on the browser or any other text box on the html page the div (datatable) remains open.It closes only when clicked in the table.
Since i am making mulitselect combo,if u can provide some help on the above also as how to close if user click on anywhere on the screen i.e functionality like a select box in html
Thanks