Skip to content

Instantly share code, notes, and snippets.

@eduardolundgren
Created April 25, 2012 02:39
Show Gist options
  • Select an option

  • Save eduardolundgren/2485740 to your computer and use it in GitHub Desktop.

Select an option

Save eduardolundgren/2485740 to your computer and use it in GitHub Desktop.
<aui:script>
Liferay.provide(
window,
'<portlet:namespace />load',
function(url, callback) {
var A = AUI();
var response = null;
A.io.request(
url,
{
dataType: 'json',
sync: true,
on: {
success: function() {
if (callback) {
callback(this.get('responseData'));
}
}
}
}
);
},
['aui-io-request']
);
Liferay.provide(
window,
'<portlet:namespace />syncSelects',
function() {
var A = AUI();
new Liferay.DynamicSelect(
[
{
select: '<portlet:namespace />states',
selectData: function(callback) {
<portlet:namespace />load('<liferay-portlet:resourceURL id="states" />', callback);
},
selectDesc: 'nome',
selectId: 'id'
},
{
select: '<portlet:namespace />regions',
selectData: function(callback) {
<portlet:namespace />load('<liferay-portlet:resourceURL id="squares" />', callback);
},
selectDesc: 'name',
selectId: 'id'
}
]
);
},
['liferay-dynamic-select']
);
<portlet:namespace />syncSelects();
</aui:script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment