Hi,
Trying to use dynamicFetch operation using SGWT.mobile in the same way I use it in desktop version.
I am setting the fetchOperation on a TableView using :
Calling the fetch as follows:
with the ds portion to declare custom dynamic fetch as follows
and the server code to do the fetch as follows:
The problem is that the server code (dmi) never gets called.
Thanks for your help, Ben.
Trying to use dynamicFetch operation using SGWT.mobile in the same way I use it in desktop version.
I am setting the fetchOperation on a TableView using :
Code:
setFetchOperation("dynamicFetch");
Code:
Map<String,Object> requestParameters = new HashMap<String,Object>(); requestParameters.put("dynamicSelectClause",dynamicSelectClause); requestParameters.put("dynamicGroupClause",dynamicGroupClause); DSRequest rq = new DSRequest(); rq.setParams(requestParameters); tableAccounting.fetchData(c1, new DSCallback(){ public void execute(DSResponse response,Object rawData,DSRequest request) { String ids = null; Record records[] = response.getData(); if (records!=null&&records.length==1){ ids = records[0].getAttribute("id_person_owners"); } applySecurity(ids,null); } },rq);
Code:
<operationBinding operationType="fetch" operationId="dynamicFetch"> <serverObject lookupStyle="new" className="be.celerity.moon.server.dmi.DynamicSQLDMI" /> <selectClause> $rawValue.dynamicSelectClause </selectClause> <tableClause> $defaultTableClause </tableClause> <whereClause> $defaultWhereClause </whereClause> <groupClause> $rawValue.dynamicGroupClause </groupClause> </operationBinding> </operationBindings>
Code:
package be.celerity.moon.server.dmi; import javax.servlet.http.HttpServletRequest; import com.isomorphic.datasource.DSRequest; import com.isomorphic.datasource.DSResponse; public class DynamicSQLDMI { public DSResponse fetch(DSRequest dsRequest) { DSResponse dsResponse = new DSResponse(); HttpServletRequest request = dsRequest.getHttpServletRequest(); String dynamicSelectClause = (String)request.getParameter("dynamicSelectClause"); if (dynamicSelectClause!=null) dsRequest.addToTemplateContext("dynamicSelectClause",dynamicSelectClause); String dynamicTableClause = (String)request.getParameter("dynamicTableClause"); if (dynamicTableClause!=null) dsRequest.addToTemplateContext("dynamicTableClause",dynamicTableClause); String dynamicWhereClause = (String)request.getParameter("dynamicWhereClause"); if (dynamicWhereClause!=null) dsRequest.addToTemplateContext("dynamicWhereClause",dynamicWhereClause); String dynamicOrderClause = (String)request.getParameter("dynamicOrderClause"); if (dynamicOrderClause!=null) dsRequest.addToTemplateContext("dynamicOrderClause",dynamicOrderClause); String dynamicGroupClause = (String)request.getParameter("dynamicGroupClause"); if (dynamicGroupClause!=null) dsRequest.addToTemplateContext("dynamicGroupClause",dynamicGroupClause); try { dsResponse = dsRequest.execute(); } catch (Exception e) { e.printStackTrace(); } return dsResponse; } }
The problem is that the server code (dmi) never gets called.
Thanks for your help, Ben.
Comment