Fórum
Populate Portlet with Json element
michele terlizzi, modificado 8 Anos atrás.
Populate Portlet with Json element
New Member Postagens: 3 Data de Entrada: 03/03/15 Postagens Recentes
Hi All,
I'm very newbie with liferay and web development. I'm trying to develop a portlet with a combobox and a datepicker
and populate a chart with data.
I'm trying to use aui elements in view.jsp.
The question is that I need to populate the select item (in the example above: Research1,Research2,Research3) using a remote RestFull Service which return me a Json Array and pressing a button I need to call another service to populate the graph.
Any help is appreciated.
Mario
I'm very newbie with liferay and web development. I'm trying to develop a portlet with a combobox and a datepicker
and populate a chart with data.
I'm trying to use aui elements in view.jsp.
<aui:form action="" method="post" name="fm">
<aui:select name="SelectResearch" type="select" label="Select Research">
<aui:option value="" label="Research1" selected="true" />
<aui:option value="" label="Research2" selected="false" />
<aui:option value="" label="Research3" selected="false" />
</aui:select>
<aui:button-row>
<button class="aui-button aui-button-primary">Update</button>
</aui:button-row>
</aui:form>
The question is that I need to populate the select item (in the example above: Research1,Research2,Research3) using a remote RestFull Service which return me a Json Array and pressing a button I need to call another service to populate the graph.
Any help is appreciated.
Mario
Liferay Krrishna, modificado 8 Anos atrás.
RE: Populate Portlet with Json element
Junior Member Postagens: 81 Data de Entrada: 17/05/15 Postagens Recentes
Call a method on loadof jsp page.
<select id='uniqueID' name="status">
</select>
<script>
function getImgPath(){
var A = AUI();
var imagePath=window.location.protocol + '//' + window.location.host;
A.io.request(host+'/api/jsonws/dlapp/get-file-entry',//chnage to ur web service url
{
method: 'GET',
dataType: 'json',
data:{fileEntryId:Number(str)},
on: {
success: function(){
var data = this.get('responseData');
var status = document.getElementsByName("status")[0];
var jsonArr = data ;
for (var i = 0; i < status.options.length; i++) {
jsonArr.push({
id: status.options.text,
optionValue: status.options.value
});
} }
}
});
}
</script>
<select id='uniqueID' name="status">
</select>
<script>
function getImgPath(){
var A = AUI();
var imagePath=window.location.protocol + '//' + window.location.host;
A.io.request(host+'/api/jsonws/dlapp/get-file-entry',//chnage to ur web service url
{
method: 'GET',
dataType: 'json',
data:{fileEntryId:Number(str)},
on: {
success: function(){
var data = this.get('responseData');
var status = document.getElementsByName("status")[0];
var jsonArr = data ;
for (var i = 0; i < status.options.length; i++) {
jsonArr.push({
id: status.options.text,
optionValue: status.options.value
});
} }
}
});
}
</script>