Hi folks,
I have two tables (Client and Profile) with the following columns:
Client: ID, NAME
Profile: CLIENT_ID, PROFILE_NAME
Now, I have a combobox to display all client profiles.
But instead of the client id, I want to see her/his name.
This works perfect in a table with a ListGrid
but using setPickListFields in a SelectItem does not bring the client name, just the ID. Why?
Here is some code and thanks in advance:
DSClient.ds.xml
DSProfile.ds.xml
I have two tables (Client and Profile) with the following columns:
Client: ID, NAME
Profile: CLIENT_ID, PROFILE_NAME
Now, I have a combobox to display all client profiles.
But instead of the client id, I want to see her/his name.
This works perfect in a table with a ListGrid
but using setPickListFields in a SelectItem does not bring the client name, just the ID. Why?
Here is some code and thanks in advance:
Code:
... ListGridField clientField = new ListGridField("client"); clientField.setWidth(35); clientField.setOptionDataSource(DataSource.get("DSClient")); clientField.setDisplayField("description"); ... // I think here is the mistake, this overrides everything! // But I donīt know any other way clientSel.setOptionOperationId("getMyProfiles"); clientSel.setOptionDataSource(DataSource.get("DSProfile")); clientSel.setPickListFields(clientField);
Code:
<DataSource ... > <fields> <field primaryKey="true" name="id" type="sequence"></field> <field name="name" length="45" type="text"></field> </fields> </DataSource>
Code:
... <fields> <field primaryKey="true" name="client_id" foreignKey="DSClient.id" type="number"></field> <field title="Profile name" name="profile_name" type="text"></field> ... <operationBindings> <operationBinding operationType="fetch" operationId="getMyProfiles" requiresAuthentication="true"> <criteria fieldName="userid" value="$servletRequest.remoteUser"/> <whereClause>payfits.profile.client != '' AND payfits.profile.secGroup != 'admin' AND ($defaultWhereClause)</whereClause> </operationBinding> </operationBindings>
Comment