Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X
I am converting some old JCA tables to MVC but customization guide lacks sufficient examples to a certain area, using "addServiceArgument" in the getModel section. Here is my existing code:
<jca:getModel var="tableModel" descriptor="${tableDescriptor}"
serviceName="customization.change.GoodrichECReportServiceImpl"
methodName="getBOMDifferences">
<jca:addServiceArgument value="${pair}" type="customization.change.PLPair"/>
</jca:getModel>
Now, I have created my custom Table builder class and defined my columns. The code above would be replaced with buildComponentData(...) as shown on page 612 of customizer's guide. However, PTC skirted the example. They were passing in a user and an Integer. In the MVC example, they did not show how an object could be retrieved from I assume, ComponentParams object.
In my case above, looping over the table in JSP, creating multiple tables. The ID, labels and PLPair class changes for each one so all of that needs to be passed into the builder. ComponentParams does list where you can set and get objects by name but no examples are given. In addition, the MVC call only shows a simple call to render table.
Hi @avillanueva , just curious if you were able to find a solution for implementing multiple MVC tables in the same JSP? If yes, how did you handle the ComponentBuilder?
Oldie. Must have since I have it running in production. I will look for my code later for examples.
This is what I ended up doing which I believe is older styling and methods. This runs a loop over the table definition so the end result is a series of tables showing in my case parts list differences for each paired BOM on a change notice.
<%--
Document : ViewPartsListsDiff
Created on : Jun 16, 2009, 12:28:56 PM
Author : antonio.villanueva
--%>
<%@ page import="wt.fc.*, wt.change2.*, customization.change.*"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"
%><%@ taglib uri="http://www.ptc.com/windchill/taglib/components" prefix="jca"
%><%@ taglib uri="http://www.ptc.com/windchill/taglib/fmt" prefix="fmt"
%><%@ taglib uri="http://www.ptc.com/windchill/taglib/core" prefix="wc"
%><%@ taglib uri="http://www.ptc.com/windchill/taglib/changeWizards" prefix="cwiz"
%>
<%
Persistable p1 = (Persistable) (commandBean.getPageOid()).getRef();
List<PLPair> pairs;
if (p1 instanceof WTChangeOrder2)
{
WTChangeOrder2 ecn=(WTChangeOrder2)p1;
pairs=customization.change.GoodrichECReportServiceImpl.getPartListsPair(ecn);
if (pairs != null)
{
int i=0;
for (PLPair pair:pairs)
{
i++;
pageContext.setAttribute("pair", pair);
String id="bom.diff."+pair.getResultingPart().getNumber();
String label="Parts List to be changed:PL "+pair.getResultingPart().getNumber();
%>
<c:set var="tableID" value="<%=id%>" />
<c:set var="tableLabel" value="<%=label%>" />
<jca:describeTable var="tableDescriptor" id="${tableID}" label="${tableLabel}" configurable="false">
<jca:setComponentProperty key="scrollType" value="D"/>
<jca:describeColumn id="changeCode" label="Change Code"/>
<jca:describeColumn id="actionCode" label="Action" />
<jca:describeColumn id="findNumber" label="Find No."/>
<jca:describeColumn id="cageCode" label="FSCM No." />
<jca:describeColumn id="quantity" label="Qty" dataUtilityId="goodrichPLDiff"/>
<jca:describeColumn id="number" label="Number"/>
<jca:describeColumn id="name" label="Description" dataUtilityId="wrapString"/>
<jca:describeColumn id="refDesignators" label="Circuit Designator" dataUtilityId="wrapString"/>
</jca:describeTable>
<jca:getModel var="tableModel" descriptor="${tableDescriptor}"
serviceName="customization.change.GoodrichECReportServiceImpl"
methodName="getBOMDifferences">
<jca:addServiceArgument value="${pair}" type="customization.change.PLPair"/>
</jca:getModel>
<jca:renderTable model="${tableModel}" useJSCA="false"/>
<%
}
}
}
%>
