Hi Isomorphic,
I have the following use-case:
ds.xml with:
I display the joined value for the ID. In my ListGridField for "LEADTEMPERATURE_ID" I have:
This does work on the client (e.g. data displayed in order "Hot", "Medium", "Cold"). Nevertheless the SQL generated if I apply a sort to the ListGrid is ".... ORDER BY LEADTEMPERATURE_NAME" or even ".... ORDER BY LEADTEMPERATURE_ID" (when setting setSortByDisplayField(false)).
This is clear as the SortNormalizer can't be converted to a ORDER-BY-Clause.
I'd like to suggest an API ListGridField.setSortField(String sortField). It shouldn't be too different from what you are doing internally in case of setSortByDisplayField(true) right now, I'd guess.
That way, simple SortNormalizers can be converted to a call to this API, allowing the serverside to do the sorting.
Of course, you could also make this setting available as ds.xml field-level attribute.
What do you think?
Best regards,
Blama
I have the following use-case:
ds.xml with:
Code:
<field foreignKey="T_LEADTEMPERATURE.ID" name="LEADTEMPERATURE_ID" displayField="LEADTEMPERATURE_NAME" title="Leadtemperatur" type="integer" /> <field name="LEADTEMPERATURE_NAME" includeFrom="T_LEADTEMPERATURE.NAME" hidden="true" /> <field name="LEADTEMPERATURE_POSITION" includeFrom="T_LEADTEMPERATURE.POSITION" hidden="true" />
Code:
setSortNormalizer(new SortNormalizer() { @Override public Object normalize(ListGridRecord record, String fieldName) { return record.getAttributeAsInt("LEADTEMPERATURE_POSITION"); } });
This is clear as the SortNormalizer can't be converted to a ORDER-BY-Clause.
I'd like to suggest an API ListGridField.setSortField(String sortField). It shouldn't be too different from what you are doing internally in case of setSortByDisplayField(true) right now, I'd guess.
That way, simple SortNormalizers can be converted to a call to this API, allowing the serverside to do the sorting.
Of course, you could also make this setting available as ds.xml field-level attribute.
What do you think?
Best regards,
Blama
Comment