Fóruns

Início » Liferay Portal » English » 2. Using Liferay » General

Visualização combinada Visão plana Exibição em árvore
Tópicos [ Anterior | Próximo ]
toggle
Andrej Litowka
How to use input-move-boxes?
29 de Outubro de 2010 08:30
Resposta

Andrej Litowka

Ranking: Junior Member

Mensagens: 67

Data de entrada: 30 de Junho de 2010

Mensagens recentes

Hello all,

is ther any description or documentation for input-move-boxes? I have a list of users and would like let a portlet user to select which one should be displayed, but I'm not sure how the the nput-move-boxes work. The rightList is obviously my users' list. But how I have to define the left list and save settings?

Thanks and regards,
Andrej
Mohammed Azam
RE: How to use input-move-boxes?
29 de Outubro de 2010 22:32
Resposta

Mohammed Azam

Ranking: Regular Member

Mensagens: 142

Data de entrada: 6 de Novembro de 2009

Mensagens recentes

Hi,

Try this out in your jsp file. I am displaying the list of users on the left input box. and onsubmit the the right hand values are added to hidden variable "tolist" so that the values can be got in the action file....


 1
 2<script type="text/javascript">
 3function onSubmit(){
 4    document.<portlet:namespace />fm1.<portlet:namespace />toList.value = Liferay.Util.listSelect(document.<portlet:namespace />fm1.<portlet:namespace />toList1);
 5    }
 6</script>
 7
 8<form action="<%= actionURL1 %>"  method="post" name="<portlet:namespace />fm1" >
 9
10<%
11  int count  = UserLocalServiceUtil.getUsersCount();
12
13  List<User> userList = UserLocalServiceUtil.getUsers(0,count);
14  List leftList = new ArrayList();
15  List rightList = new ArrayList();
16  for (int k = 0; k < userList.size(); k++) {
17        User user = (User)userList.get(k);
18      leftList.add(new KeyValuePair(String.valueOf(user.getUserId()), user.getScreenName()));
19  }
20%>
21
22<liferay-ui:input-move-boxes
23    formName="fm1"
24        leftTitle="User List"
25    rightTitle="To List"
26    leftBoxName="usersList"
27    rightBoxName="toList1"
28    leftList="<%= leftList %>"
29    rightList="<%= rightList %>"
30    />
31    <input type="hidden" name="<portlet:namespace />toList" value=""/>
32
33<input type="submit" value="<liferay-ui:message key="add-users" />" onClick="onSubmit();" />


Please do the necessary imports......


Hope this give you an understanding of the input-box
Laila Ir
RE: How to use input-move-boxes?
11 de Agosto de 2011 07:04
Resposta

Laila Ir

Ranking: New Member

Mensagens: 1

Data de entrada: 7 de Julho de 2011

Mensagens recentes

Hi Mohamed,
I try to get the values in my Action Class,

long[ ] toList = StringUtil.split(ParamUtil.getString(actionRequest, "toList"), 0L);
System.out.println("List length : "+toList.length);

but I got 0 emoticon
note: I'm bad in javaScript language.

Thanks and regards,
Andrej Litowka
RE: How to use input-move-boxes?
17 de Agosto de 2011 00:48
Resposta

Andrej Litowka

Ranking: Junior Member

Mensagens: 67

Data de entrada: 30 de Junho de 2010

Mensagens recentes

Hi Laila,

what is toList? You should post the complete code.
Mohammed Azam
RE: How to use input-move-boxes?
12 de Setembro de 2011 07:40
Resposta

Mohammed Azam

Ranking: Regular Member

Mensagens: 142

Data de entrada: 6 de Novembro de 2009

Mensagens recentes

Laila Ir:
Hi Mohamed,
I try to get the values in my Action Class,

long[ ] toList = StringUtil.split(ParamUtil.getString(actionRequest, "toList"), 0L);
System.out.println("List length : "+toList.length);

but I got 0 emoticon
note: I'm bad in javaScript language.

Thanks and regards,



use it in this way and let me know.

1String param = req.getParameter("toList");
2
3    if (param != null && param != "") {
4                                        String[] temp = param.split(",");
5}


The toList is a hidden variable
Sanket Gosavi
RE: How to use input-move-boxes?
4 de Abril de 2012 03:11
Resposta

Sanket Gosavi

Ranking: Junior Member

Mensagens: 35

Data de entrada: 24 de Dezembro de 2011

Mensagens recentes

this does not work......
Hitoshi Ozawa
RE: How to use input-move-boxes?
7 de Abril de 2012 07:31
Resposta

Hitoshi Ozawa

Ranking: Liferay Legend

Mensagens: 7990

Data de entrada: 23 de Março de 2010

Mensagens recentes

Not too much documentation on liferay-ui, but may be worth to check the pages below:

http://docs.liferay.com/portal/6.1/taglibs/liferay-ui/input-move-boxes.html

http://code.google.com/p/liferaysamples/source/browse/trunk/sample-ui-taglibs-portlet/view.jsp?r=2