SmartClient Version: v10.1p_2016-12-11/Enterprise Deployment (built 2016-12-11)
Chrome Version 64.0.3282.167
I have a component xml for a ListGrid of objects that can be (but aren't always) hierarchical. I defined a field similar to what is shown in the API docs for foreignKey, but I set it to nillable since it can be null:
"objectKey" is defined as a primary key in my database and is set from a sequence in said database.
"name" is just a String name given to each object.
"parentKey" can be a null value if the object has no parent object, but I'd like to display a SelectItem on the grid record containing other objects from the same table/datasource that can be set as a parent object.
When the screen loads I can view all the defined records, and I have no issue creating or updating records while leaving parentKey empty. However, if I double click on the field for parentKey I get an empty SelectItem instead of a list of defined objects from the same table/datasource. I've tried adding displayField and valueField attributes to parentKey, setting them to name and objectKey respectively, but there's no change.
What I'd like is this: If I have a ListGrid with 2 records already defined:
I'd like to be able to add a third object, with objectKey=3 and name='Object C' and have the SelectItem in the parentKey column display 'Object A' and 'Object B' as possible options, 2 to the parentKey attribute of 'Object C' if I select 'Object B' as its parent:
Is what I'm trying to accomplish possible? If so, how can I achieve this?
Thanks in advance for any help.
Chrome Version 64.0.3282.167
I have a component xml for a ListGrid of objects that can be (but aren't always) hierarchical. I defined a field similar to what is shown in the API docs for foreignKey, but I set it to nillable since it can be null:
Code:
<DataSource ID="myDS" allowAdvancedCriteria="true"> <fields> <field name="objectKey" title="Key" hidden="true" type="integer" primaryKey="true" required="true"/> <field name="name" title="Name (Full)" hidden="false" type="text" canEdit="true"/> <field name="parentKey" title="Parent" hidden="false" type="integer" nillable="true" editorType="SelectItem" canEdit="true"cellAlign="center" foreignKey="objectKey"/> </fields> //OperationBindings here </DataSource>
"name" is just a String name given to each object.
"parentKey" can be a null value if the object has no parent object, but I'd like to display a SelectItem on the grid record containing other objects from the same table/datasource that can be set as a parent object.
When the screen loads I can view all the defined records, and I have no issue creating or updating records while leaving parentKey empty. However, if I double click on the field for parentKey I get an empty SelectItem instead of a list of defined objects from the same table/datasource. I've tried adding displayField and valueField attributes to parentKey, setting them to name and objectKey respectively, but there's no change.
What I'd like is this: If I have a ListGrid with 2 records already defined:
objectKey | name | parentKey |
1 | 'Object A' | null/empty |
2 | 'Object B' | null/empty |
I'd like to be able to add a third object, with objectKey=3 and name='Object C' and have the SelectItem in the parentKey column display 'Object A' and 'Object B' as possible options, 2 to the parentKey attribute of 'Object C' if I select 'Object B' as its parent:
objectKey | name | parentKey |
1 | 'Object A' | null/empty |
2 | 'Object B' | null/empty |
3 | 'Object C' | 2 |
Is what I'm trying to accomplish possible? If so, how can I achieve this?
Thanks in advance for any help.
Comment