Hi Quan,
Looking at what you pasted i think the problem might be with the datasource, i've never tried or saw it defined as you have and i'm not aware of changes like those in Mendix 10, but i think it's that. For you to have an attribute and connect it with a datasource, and i imagine this is your scenario since you want to define X columns, you need to define one with type="datasource" and then all fields you want from this datasource you put them pointing to your datasource, like this:
<property key="mydatasource" type="datasource">
<caption>mydatasource</caption>
<description>mydatasource</description>
</property>
<property key="column1" type="attribute" dataSource="mydatasource">
<caption>Column 1</caption>
<description>Column 1</description>
<attributeTypes>
<attributeType name="String"/>
</attributeTypes>
</property>
You can also take a look in this documentation since it has some examples, it might help you: https://docs.mendix.com/howto/extensibility/pluggable-widgets/
Hope it helps,
Rui.
Thank Rui,
Actually, I have no problem with the data source type and the attribute type in the configuration XML file. In the widget property popup (by double click the widget in Mendix Studio Pro), I can also select a property of the data source to assign to this column too.
I will give a situation with the data model and your xml definition as below
<property key="mydatasource" type="datasource">
<caption>mydatasource</caption>
<description>mydatasource</description>
</property>
<property key="column1" type="attribute" dataSource="mydatasource">
<caption>Column 1</caption>
<description>Column 1</description>
<attributeTypes>
<attributeType name="String"/>
</attributeTypes>
</property>
In the widget property popup, when user select the Name property for the Column 1.
How can we know which property user had selected (in this case, the Name property) in the coding?
I also referenced this document: List Values | Mendix Documentation, but do not have information that I need
Hi Rui,
More detail in this situation to explain why I also need the property name
For example:
I hope it can explain it more to you.
Thank you
Hi Quan,
Answering to your question "How can we know which property user had selected (in this case, the Name property) in the coding?", the Name, which is the attribute that in Mendix was selected to fill the property column1, will be available for you in the structure of the widget in the attribute column1. in case that your "mydatasource" is a list, you can iterate through it and for each "mydatasourceobj", you can do column1.get(mydatasourceobj).value
Does this answer your question?
Rui.