Skip to main content
4-Participant
August 31, 2023
Question

The customized dataUtility of WTPart's attribute can't show Part > Structure page.

  • August 31, 2023
  • 1 reply
  • 2164 views

I defined a datautility to control the display text of some Attributes, but when I looked on the attribute tab of the structure Tab, I didn't see it as I saw it on the main attribute page(first Tab). When I debug the attribute of the structure tab, I found that it would enter the getPlainDataValue method of DataUtility. But the first parameter to this method is just the id of the registered datautility instead of the normal component id, so how do I get the original value of the component with datautility set?

 

 

 

 

1 reply

HelesicPetr
22-Sapphire II
22-Sapphire II
August 31, 2023

HI @YT_9085185 

You need to implement  LogicSeparatedDataUtility 

public class MyDataUtility extends AbstractDataUtility implements LogicSeparatedDataUtility
{
}

 

Then you can use method in your DU

public Object getPlainDataValue(String columnName, Object rowObject, ModelContext modelContext) throws WTException
{
return ((ConfigPropertiesItem) rowObject).getFileName(); // own object where filename is return as a string
}

 

Just use the original function in the getPlainDataValue and convert the value to a String that is shown in the structure

 

this.getDataValue(columnName, rowObject, modelContext);

 

 

PetrH

4-Participant
August 31, 2023

I tried it your way. I couldn't get anything.The ID is still the ID of datautility.As an alternative, I'm going to define multiple DUs, each configured to a fixed attribute.

tks

pic1.png

HelesicPetr
22-Sapphire II
22-Sapphire II
August 31, 2023

Hi @YT_9085185

the gerDataValue needs to be defined in you class, and you need to get the values. 

String id is the attribute ID Object is the row object that is shown, and ModelContext is where the other information from the browser are stored.

From that you need to get value what you need by your code. 

 

PetrH