Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

Bug: Configure Sort Dialog has fieldname instead of title on start

$
0
0
Hi Isomorphic,

please see this code (BuiltInDS-based, v9.1p_2014-07-24, FF26 Dev mode) and the screenshot. The dialog should display "Our Title" instead of "status".

BuiltInDS.java
Code:

package com.smartgwt.sample.client;

import com.google.gwt.core.client.EntryPoint;
import com.smartgwt.client.core.KeyIdentifier;
import com.smartgwt.client.data.DataSource;
import com.smartgwt.client.data.SortSpecifier;
import com.smartgwt.client.types.SortDirection;
import com.smartgwt.client.util.PageKeyHandler;
import com.smartgwt.client.util.Page;
import com.smartgwt.client.util.SC;
import com.smartgwt.client.widgets.IButton;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.layout.VLayout;

/**
 * Entry point classes define <code>onModuleLoad()</code>.
 */
public class BuiltInDS implements EntryPoint {
        private ListGrid boundList;
        private IButton btn;

        /**
        * This is the entry point method.
        */
        public void onModuleLoad() {
                KeyIdentifier debugKey = new KeyIdentifier();
                debugKey.setCtrlKey(true);
                debugKey.setKeyName("D");

                Page.registerKey(debugKey, new PageKeyHandler() {
                        public void execute(String keyName) {
                                SC.showConsole();
                        }
                });

                boundList = new ListGrid(DataSource.get("animals"));
                boundList.setWidth(1200);
                boundList.setHeight(600);
                boundList.setCanMultiSort(true);
                boundList.setCanSort(true);
                boundList.setShowFilterEditor(true);
                boundList.setAutoFetchData(false);

                ListGridField commonName = new ListGridField("commonName");
                ListGridField scientificName = new ListGridField("scientificName");
                ListGridField lifeSpan = new ListGridField("lifeSpan");
                lifeSpan.setTitle("Our title");
                lifeSpan.setSortByDisplayField(true);
                // ListGridField status = new ListGridField("status");
                ListGridField diet = new ListGridField("diet");
                ListGridField information = new ListGridField("information");

                boundList.setFields(commonName, scientificName, lifeSpan, diet, information);
                boundList.setSort(new SortSpecifier("lifeSpan", SortDirection.ASCENDING));
                boundList.fetchData();

                btn = new IButton("invalidateCache()");
                btn.addClickHandler(new ClickHandler() {
                        @Override
                        public void onClick(ClickEvent event) {
                                boundList.invalidateCache();
                        }
                });

                VLayout vLayout = new VLayout(10);
                vLayout.setMembers(boundList, btn);
                vLayout.draw();
        }
}

animals.ds.xml
Code:

<DataSource
    ID="animals"
        serverType="sql"
        tableName="animals"
    testFileName="animals.data.xml"
>
    <fields>
        <field name="commonName"      title="Animal"            type="text"/>
        <field name="scientificName"  title="Scientific Name"    type="text"  primaryKey="true"  required="true"/>
        <field name="lifeSpan"        title="LIFESPAN BUT WE SHOW STATUS"  displayField="status"        type="integer"/>
        <field name="status"          title="Endangered Status"  type="text">
            <valueMap>
                <value>Threatened</value>
                <value>Endangered</value>
                <value>Not Endangered</value>
                <value>Not currently listed</value>
                <value>May become threatened</value>
                <value>Protected</value>
            </valueMap>
        </field>
        <field name="diet"            title="Diet"              type="text"/>
        <field name="information"    title="Interesting Facts"  type="text"  length="1000"/>
        <field name="picture"        title="Picture"            type="image" detail="true"
              imageURLPrefix="/isomorphic/system/reference/inlineExamples/tiles/images/"/>
    </fields>
</DataSource>

The name is corrected if you click the column title "Our Title" to sort.

Best regards,
Blama

Attached Images
File Type: png SortDialogFieldName.png (21.8 KB)

Viewing all articles
Browse latest Browse all 4756

Trending Articles