Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    ListGridField.setSortByDisplayField does not pick up .ds.xml's displayField="FIELD"

    Hi Isomorphic,

    I have following code:

    .ds.xml fields:
    Code:
    <field foreignKey="T_CAMPAIGN.ID" name="CAMPAIGN_ID" [B]displayField="CAMPAIGN_NAME"[/B] type="integer"></field>
    <field name="CAMPAIGN_NAME" includeFrom="T_CAMPAIGN.NAME" hidden="true"></field>
    ListGrid:
    Code:
    ...
    ListGridField campaignLGF = new [B]ListGridFieldCampaign[/B]("CAMPAIGN_ID");
    setSort(new SortSpecifier[] { new SortSpecifier("CAMPAIGN_ID", SortDirection.ASCENDING) });
    setFields(campaignLGF, ...);
    fetchData();
    ListGridFieldCampaign:
    Code:
    public final class ListGridFieldCampaign extends ListGridField {
    
    	public ListGridFieldCampaign(final String name) {
    		super(name);
    		[B]TRY WITH OR WITHOUT: setDisplayField("CAMPAIGN_NAME");[/B]
    		setSortByDisplayField(true);
    	}
    }
    Depending on setDisplayField("CAMPAIGN_NAME") in ListGridFieldCampaign the fetch() sorts by either T_CAMPAIGN.ID or T_CAMPAIGN.NAME.
    I think it should always sort by T_CAMPAIGN.NAME (because of the displayField="CAMPAIGN_NAME" in .ds.xml). Is that true?

    Best regards,
    Blama
Working...
X