掲示板
aui:select store
Hi All,
I need to fill a aui:select store with dynamic select as did for Region Country User Settings.
What is the best way?
I have to put:
List<Country> countries = CountryServiceUtil.getCountries();
List<Region> regions = RegionServiceUtil.getRegions();
in page scope or there is a better way to pass to jsp the store to fill the aui:select?
Can you show me some example?
Thanks
Fabio
I need to fill a aui:select store with dynamic select as did for Region Country User Settings.
What is the best way?
I have to put:
List<Country> countries = CountryServiceUtil.getCountries();
List<Region> regions = RegionServiceUtil.getRegions();
in page scope or there is a better way to pass to jsp the store to fill the aui:select?
Can you show me some example?
Thanks
Fabio
12年前 に Thiago Leão Moreira によって更新されました。
RE: aui:select store
Liferay Legend 投稿: 1449 参加年月日: 07/10/10 最新の投稿
Take a look for an Ajax call at /portal/portal-web/docroot/html/portlet/directory/organization_search.jsp
I found some tip but in my portlet I need to execute:
themeDisplay.setIncludeServiceJs(true)
how and where can I create a themeDisplay object?
I've tryied to include in my view.jsp with unresolved object error....
The final question is to use Liferay.Address.getCountries service.
And if I have in my page:
<%
List<Country> countries = CountryServiceUtil.getCountries();
List<Region> regions = RegionServiceUtil.getRegions();
%>
How can I assign the list (example countries) to to aui:select???
Thank you
Fabio
themeDisplay.setIncludeServiceJs(true)
how and where can I create a themeDisplay object?
I've tryied to include in my view.jsp with unresolved object error....
The final question is to use Liferay.Address.getCountries service.
And if I have in my page:
<%
List<Country> countries = CountryServiceUtil.getCountries();
List<Region> regions = RegionServiceUtil.getRegions();
%>
How can I assign the list (example countries) to to aui:select???
Thank you
Fabio
12年前 に Thiago Leão Moreira によって更新されました。
RE: aui:select store
Liferay Legend 投稿: 1449 参加年月日: 07/10/10 最新の投稿
themeDisplay is an implicit object and it is available through tag <liferay-theme:defineObjects />. For instance
<%@ taglib uri="http://liferay.com/tld/theme" prefix="liferay-theme" %>
<liferay-theme:defineobjects />
<%
themeDisplay.setIncludeServiceJs(true);
%>
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
<%@ taglib uri="http://liferay.com/tld/aui" prefix="aui" %>
<%@ page import="java.util.List" %>
<%@ page import="com.liferay.portal.service.CountryServiceUtil" %>
<%@ page import="com.liferay.portal.service.RegionServiceUtil" %>
<%@ page import="com.liferay.portal.model.Country" %>
<%@ page import="com.liferay.portal.model.Region" %>
<%@ page import="com.liferay.portal.theme.ThemeDisplay" %>
<script src="/html/js/liferay/service.js" type="text/javascript"></script>
<%@ taglib uri="http://liferay.com/tld/theme" prefix="liferay-theme" %>
<portlet:defineObjects />
<%
themeDisplay.setIncludeServiceJs(true);
%>
result:
themeDisplay cannot be resolved
<%@ taglib uri="http://liferay.com/tld/aui" prefix="aui" %>
<%@ page import="java.util.List" %>
<%@ page import="com.liferay.portal.service.CountryServiceUtil" %>
<%@ page import="com.liferay.portal.service.RegionServiceUtil" %>
<%@ page import="com.liferay.portal.model.Country" %>
<%@ page import="com.liferay.portal.model.Region" %>
<%@ page import="com.liferay.portal.theme.ThemeDisplay" %>
<script src="/html/js/liferay/service.js" type="text/javascript"></script>
<%@ taglib uri="http://liferay.com/tld/theme" prefix="liferay-theme" %>
<portlet:defineObjects />
<%
themeDisplay.setIncludeServiceJs(true);
%>
result:
themeDisplay cannot be resolved
Fabio Foglia:
result:
themeDisplay cannot be resolved
You need to create object for themeDisplay,
ThemeDisplay themeDisplay = (ThemeDisplay)request.getAttribute(com.liferay.portal.kernel.util.WebKeys.THEME_DISPLAY);
Thank you Mani...It works !!!
Do you know where is the logic to manage a 3th level of indirection?
I need to expand the login to a 3th combo box depending on regionid as did for countries.
I have a new "city" table on db populated with city areas and linked to regionid of region table as did for coutries.
I have to manage the same mechanism to fill the 3th combo on region combo data.
Thanks
Fabio
Do you know where is the logic to manage a 3th level of indirection?
I need to expand the login to a 3th combo box depending on regionid as did for countries.
I have a new "city" table on db populated with city areas and linked to regionid of region table as did for coutries.
I have to manage the same mechanism to fill the 3th combo on region combo data.
Thanks
Fabio
Fabio Foglia:
Thank you Mani...It works !!!
Do you know where is the logic to manage a 3th level of indirection?
I need to expand the login to a 3th combo box depending on regionid as did for countries.
I have a new "city" table on db populated with city areas and linked to regionid of region table as did for coutries.
I have to manage the same mechanism to fill the 3th combo on region combo data.
Thanks
Fabio
how can we add 3item.. i want to add new list which come from my db.
can i use my serviceutil instead of Liferay.Address.getCountries?
Fabio Foglia:
Hi All,
I need to fill a aui:select store with dynamic select as did for Region Country User Settings.
What is the best way?
I have to put:
List<Country> countries = CountryServiceUtil.getCountries();
List<Region> regions = RegionServiceUtil.getRegions();
in page scope or there is a better way to pass to jsp the store to fill the aui:select?
Can you show me some example?
Thanks
Fabio
Hi Fabio,
Find the code below to achieve Country > Region functionality using Dynamic Select
<aui:script use="liferay-dynamic-select,aui-io-request">
new Liferay.DynamicSelect(
[
{
select: '<portlet:namespace />countryId',
selectData: Liferay.Address.getCountries,
selectDesc: 'name',
selectId: 'countryId',
selectVal: ''
},
{
select: '<portlet:namespace />regionId',
selectData: Liferay.Address.getRegions,
selectDesc: 'name',
selectId: 'regionId',
selectVal: ''
}
]
);
</aui:script>
<aui:field-wrapper>
<aui:column columnwidth="20">Country</aui:column>
<aui:column><aui:select label="" name="countryId" /></aui:column>
</aui:field-wrapper>
<aui:field-wrapper>
<aui:column columnwidth="20">Region</aui:column>
<aui:column><aui:select label="" name="regionId" /></aui:column>
</aui:field-wrapper>
Don't forget to include the service.js file in your jsp.
Alternatively you can achieve the same functionality using Ajax.
Hope this helps,
Regards,
Tanweer
mPowerian-BoschLer
sorry to pick up this thread after it appears to be resolved.
I have an issue on using DynamicSelect as in the classic adddresses pages:
I am trying to put this on a public page to create users, I am getting JSON response "{"exception":"Please sign in to invoke this method""
I can include "List<Country> countries = CountryServiceUtil.getCountries();" without any security issues but obviously do not get the list changes from changing the country
I have even switched off JSON security tokens in portal-ext.properties:
json.service.auth.token.enabled=false
So what is causing a security issue here and how can it be made public?
I have an issue on using DynamicSelect as in the classic adddresses pages:
<aui:script use="liferay-dynamic-select">
new Liferay.DynamicSelect(
[
{
select: '<portlet:namespace />addressCountryId<%= addressesIndex %>',
selectData: Liferay.Address.getCountries,
selectDesc: 'name',
selectId: 'countryId',
selectVal: '<%= countryId %>'
},
{
select: '<portlet:namespace />addressRegionId<%= addressesIndex %>',
selectData: Liferay.Address.getRegions,
selectDesc: 'name',
selectId: 'regionId',
selectVal: '<%= regionId %>'
}
]
);
</aui:script>
I am trying to put this on a public page to create users, I am getting JSON response "{"exception":"Please sign in to invoke this method""
I can include "List<Country> countries = CountryServiceUtil.getCountries();" without any security issues but obviously do not get the list changes from changing the country
I have even switched off JSON security tokens in portal-ext.properties:
json.service.auth.token.enabled=false
So what is causing a security issue here and how can it be made public?