Open Bordoloi123 opened 2 months ago
Hi @Bordoloi123, thanks for filing the issue. Got some questions about this:
Your proposed image has the category block labeled "Cant Station Points" in plural. Ours just shows class label, which is singular. Is that a problem?
We'll need to know which is property of the related class to use for display label. Is it identified in your schema somehow?
Do you expect that property to be hidden from property list when you expand the instance properties list?
You're proposing to show instance label instead of index when the label is not null.
[123]
ones.To fix the above, I suggest always showing an index and then appending the label, if there is one, e.g. [123] My label
. What do you think?
Hi @grigasp
1 .Your proposed image has the category block labeled "Cant Station Points" in plural. Ours just shows class label, which is singular. Is that a problem?
You can ignore this. That was typo in the image.If required in plurals, we will make the changes in our schema.
2.We'll need to know which is property of the related class to use for display label. Is it identified in your schema somehow?
We have decided to set the display label through IECInstance::SetDisplayLabel , on our side. So if the display label is available, you have to just render that in property pane.
3.Do you expect that property to be hidden from property list when you expand the instance properties list? Answered in point 2.
4.You're proposing to show instance label instead of index when the label is not null. Yes
I'm worried there could be duplicate instance labels, resulting in duplicate groups. In case some related instances have labels and some don't, we could end up with a weird list where some blocks have proper labels and some have [123] ones.
This is a valid concern and it wont hamper us if the index is also displayed along the display label.
Thank you for detailed questions.
- We'll need to know which is property of the related class to use for display label. Is it identified in your schema somehow?
We have decided to set the display label through IECInstance::SetDisplayLabel , on our side. So if the display label is available, you have to just render that in property pane.
- Do you expect that property to be hidden from property list when you expand the instance properties list?
Answered in point 2.
An ECInstance doesn't have a special label property. When you use IECInstance::SetDisplayLabel
, it attempts to find a regular property that should be used as the label (using class custom attributes or property name as the means to identify it). So question 3 remains unanswered, since the property used as a label will also appear in the properties list.
- We'll need to know which is property of the related class to use for display label. Is it identified in your schema somehow?
We have decided to set the display label through IECInstance::SetDisplayLabel , on our side. So if the display label is available, you have to just render that in property pane.
- Do you expect that property to be hidden from property list when you expand the instance properties list?
Answered in point 2.
An ECInstance doesn't have a special label property. When you use
IECInstance::SetDisplayLabel
, it attempts to find a regular property that should be used as the label (using class custom attributes or property name as the means to identify it). So question 3 remains unanswered, since the property used as a label will also appear in the properties list.
In that case, we will set (int the cited example) "Station" property as the display label and the property will also appear in the properties list.
Sounds good. Here's what needs to be done:
imodel-native
: When creating content for related instances, also read their labels and include them in resulting nested content values.itwinjs-core
: Add an optional label
attribute to NestedContentValue
.presentation-components
: When creating PropertyRecord
from NestedContentValue
ensure the label attribute is carried over.components-react
: Ensure that array items' (of type PropertyRecord
) labels are rendered next to the index, when rendering the property grid.We should be able to implement this in itwinjs-core@4.8
timeframe.
We should be able to implement this in
itwinjs-core@4.8
timeframe.
Thank you!
On hold till itwinjs-core
4.8 release. Then we'll need:
itwinjs-core
dev dependencies of presentation-components
to 4.8
,presentation-components
Required appui changes are released with @itwin/components-react@4.16.0
@Bordoloi123, FYI the last missing piece was just released. You should start seeing the labels after updating the following dependencies:
4.8
4.16
5.4.2
Please note that the label will not be visible if we can't find a label for the related instance. One of the ways to attach label property to instances of specific class is to use a instance label override rule the ruleset you use to get the properties. With it, you can say that instance label should be set to some specific property value (through property value specification).
I'll keep this issue open until you confirm that everything works as expected - please let us know.
For example, while displaying cant station point properties in the property pane, indexis displayed for each point and not the actual name as seen in OpenRail.![image](https://github.com/iTwin/presentation/assets/127859840/68a0bc74-d09c-4bcf-b075-d7c9cffacb74)
We want the points to be displayed as![image](https://github.com/iTwin/presentation/assets/127859840/d85653be-5c8a-492d-a62b-79131a073a8e)