Want to check if rest service control does not honour context.getSubmittedValue() for viewName property? REST Service view name is not being computed when partialRefresh is done on parent panel. I am trying to load different views (DataTable used for display) and need to work with JSON object. However, when I click on accordion entry which updates a panel in another custom control, I can see submitted value changing using computed field but my REST service control will still return old data. Here is the code should you want to have a look:
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core" xmlns:xe="http://www.ibm.com/xsp/coreex">
<xp:panel id="panelMiddle">
<xp:text escape="true" id="computedField1" value="#{javascript:context.getSubmittedValue()}"></xp:text>
<xe:restService id="restService1" pathInfo="data" preventDojoStore="true" state="false">
<xe:this.service>
<xe:viewItemFileService defaultColumns="true" contentType="application/json" compact="true" systemColumns="0">
<xe:this.viewName><![CDATA[#{javascript:var v = context.getSubmittedValue();
if (null == v){
v = application.getString("defaultView");
}
}]]></xe:this.viewName>
<xe:this.count><![CDATA[#{javascript:
var v = context.getSubmittedValue();
if (null == v){
v = application.getString("defaultView");
}
database.getView(v).getEntryCount();
}]]></xe:this.count>
</xe:viewItemFileService>
</xe:this.service>
</xe:restService>
<div id="demo"></div>
<xp:eventHandler event="onClientLoad" submit="false">
<xp:this.script><![CDATA[$(document).ready(function() {
$.ajax({
url:"New.xsp/data",
dataType:"json",
success:
function(data){
var colHeaders = [];
var tarr = [];
$.each(data.items[0], function (key, val) {
if(key.indexOf("@")==-1){
colHeaders.push({"title":key});
//colHeaders.push({"data":key});
}
});
$.each(data.items,function(v,i){
var temp = [];
$.each(i,function(k,vv){
if(k.indexOf("@")==-1){temp.push(vv)};
})
tarr.push(temp);
})
$('#demo').html( '<table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered table-hover" id="example"></table>' );
$('#example').DataTable( {
"data": tarr,
"columns": colHeaders
} );
}
});
});]]></xp:this.script>
</xp:eventHandler>
</xp:panel>
</xp:view>