Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X
I am trying to create a table UI on click on actions command on a popup page. Table is coming a plain page without table borders
Below are the steps followed,
Step 1: Added custom-actionmodels.xml
<model name="agileActions" resourceBundle="jp.co.lixil.individualbom.actions.ui.resource.NavigationRB">
<action name="pushParts" type="object"/> <!-- Send Part -->
<action name="pushBOM" type="object"/> <!-- Send BOM -->
<action name="pushDrawing" type="object"/> <!-- Send Drawing -->
<action name="AgilePartsList" type="navigation"/>
</model>
Step 2: Added actions in custom-actions.xml
<objecttype name="navigation" class="" resourceBundle="com.co.ui.resource.NavigationRB">
<action name="AgilePartsList">
<component name="com.co.agile.parts" windowType="popup"/>
</action>
</objecttype>
Step 3: RB File Entry for this action in NavigationRB.java
@RBEntry("Parts List To Agile")
public static final String PRIVATE_CONSTANT_24 = "navigation.AgilePartsList.title";
@RBEntry("Parts List To Agile")
public static final String PRIVATE_CONSTANT_25 = "navigation.AgilePartsList.tooltip";
@RBEntry("Parts List To Agile")
public static final String PRIVATE_CONSTANT_26 = "navigation.AgilePartsList.description";
Step 4: Added Entry in MVSDispatcherServlet.xml
<?xml version="1.0" encoding="UTF-8"?>
<!-- - Application context definition for "MVC" DispatcherServlet. -->
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=“http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<import resource="classpath:config/mvc/mvc.xml" />
<import resource="classpath:config/mvc/jca-mvc.xml" />
<import resource="classpath:config/mvc/*-configs.xml" />
<import resource="classpath:config/mvc/custom.xml" />
<import resource="classpath:config/mvc/pac-custom.xml" />
<bean id="defaultHandlerMappings“ class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="locations">
<list>
<value> classpath😕config/mvc/*-urlMappings.properties </value>
<value>classpath😕config/mvc/custom.properties</value>
</list>
</property>
</bean>
</beans>
Step 5: pac-custom.xml file created under codebase/config/mvc/pac-custom.xml
<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.ptc.com/schema/mvc" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsdhttp://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsdhttp://www.ptc.com/schema/mvc http://www.ptc.com/schema/mvc/mvc-10.0.xsd"> <!-- Configurations in this file override all other configurations -->
<mvc:builder-scan base-package="com.co.agile.action.table.part" /></beans>
Step 6: Created a Folder under <WEB-INF>/jsp called pac/pacPartsListTable.jsp
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib tagdir="/WEB-INF/tags" prefix="tags"%>
<%@ taglib uri="http://www.ptc.com/windchill/taglib/jcaMvc" prefix="mvc"%>
<%@ include file="/netmarkets/jsp/util/begin_comp.jspf" %>
<mvc:table compId="com.pac.agile.parts"/>
<%@ include file="/netmarkets/jsp/util/end_comp.jspf"%>
Step 7: This is the table component code
package com.co.agile.action.table.part;
import com.ptc.mvc.components.AbstractComponentBuilder;
import com.ptc.mvc.components.ColumnConfig;
import com.ptc.mvc.components.ComponentBuilder;
import com.ptc.mvc.components.ComponentConfig;
import com.ptc.mvc.components.ComponentConfigFactory;
import com.ptc.mvc.components.ComponentParams;
import com.ptc.mvc.components.TableConfig;
import com.ptc.mvc.util.ClientMessageSource;
import wt.fc.PersistenceHelper;
import wt.part.WTPart;
import wt.pds.StatementSpec;
import wt.query.QuerySpec;
import wt.query.SearchCondition;
import wt.util.WTException;
import wt.vc.VersionIdentifier;
//This annotation is VERY important.
@ComponentBuilder("com.co.agile.parts")
public class AgilePublishPartsTableBuilder extends AbstractComponentBuilder {
private static final String RESOURCE = "jp.co.ui.resource.NavigationRB";
private final ClientMessageSource messageSource = getMessageSource(RESOURCE);
@Override
public ComponentConfig buildComponentConfig(ComponentParams paramComponentParams) throws WTException {
//get the ComponentConfigFactory
ComponentConfigFactory factory = getComponentConfigFactory();
//get an instance of TableConfig
TableConfig table = factory.newTableConfig();
// General table properties
table.setId("com.pac.agile.parts");
table.setSelectable(true);
table.setLabel(messageSource.getMessage("RELATED_PARTS"));
table.setShowCount(true);
//table.setActionModel("agilePushTableActions");
//add columns
//name
ColumnConfig col1 = factory.newColumnConfig("name", true);
col1.setSortable(true);
table.addComponent(col1);
//number
ColumnConfig col2 = factory.newColumnConfig("number", false);
col2.setInfoPageLink(true);
col2.setSortable(true);
table.addComponent(col2);
//type
ColumnConfig col3 = factory.newColumnConfig("type", true);
table.addComponent(col3);
// Last Modified
ColumnConfig col4 = factory.newColumnConfig("thePersistInfo.modifyStamp", true);
table.addComponent(col4);
table.setShowCustomViewLink(false);
// If you want different column name as Display name, use setLabel("New Name") function on column
// If you data as link use setInfoPageLink(true) function on column
table.setView("/pac/pacPartsListTable.jsp");
return table;
}
@Override
public Object buildComponentData(ComponentConfig paramComponentConfig, ComponentParams paramComponentParams) throws Exception {
QuerySpec qs = new QuerySpec(WTPart.class);
qs.appendWhere(new SearchCondition(wt.part.WTPart.class,WTPart.NUMBER,SearchCondition.LIKE,"%RD%"), null);
return PersistenceHelper.manager.find(qs);
}
}
Result is like this when I click on actions command,
Can someone help me to figure how to get the proper table here?
Hello Austin Nabors-Keating,
If I am not wrong, you are using Windchill 11.0 and Internet Explorer. Please try adding below line to JSP at the beginning:
<%@ include file="/netmarkets/jsp/components/beginWizard.jspf"%>
And below line to end of the JSP:
<%@ include file="/netmarkets/jsp/util/end.jspf"%>
I hope this helps you.
Regards,
Shirish
Hello, ShirishMorkhade, I'm trying to repeat this example, please tell me how in paragraph number 7 to name the file and how to run the form, I code can not understand where it is?
Please include below file in JSP
<%@ include file="/netmarkets/jsp/util/begin.jspf"%>
<%@ include file="/netmarkets/jsp/util/end.jspf"%>