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

setCanSelectCells has no effect, if getField is called before

$
0
0
I want to setup a grid, so that the user can select cells (not just whole rows). In my application I also use "getField" every now and then.

It turns out, that "setCanSelectCells" will have no effect, after the first call of "getField".

Is this a bug? Does any workaround exist?

A simple program, that reproduces the behaviour:
Code:

import java.util.logging.*;
import com.google.gwt.core.client.EntryPoint;
import com.smartgwt.client.widgets.grid.*;

public class ApplicationEntryPoint implements EntryPoint {

        @Override
        public void onModuleLoad() {

                // setup grid
                final ListGrid listGrid = new ListGrid();
                listGrid.setFields(new ListGridField[] {new ListGridField("ID"), new ListGridField("Name")});
               
                // define data
                listGrid.setData(new ListGridRecord() {{
                        setAttribute("ID", 1);
                        setAttribute("Name", "Max");
                }});

                // This is the problem
                listGrid.getField("Name"); // delete this line, and it will work

                // set cell selection mode (TRUE)
                listGrid.setCanSelectCells(true);

                // get cell selection mode (FALSE ?!)
                Boolean canSelectCells = listGrid.getCanSelectCells();
                Logger.getLogger("GWT").log(Level.INFO, "" + canSelectCells);

                listGrid.show();
        }
}

SmartClient Version: v10.0p_2015-01-28/LGPL Development Only (built 2015-01-28)
Browser: Firefox 38.0.5

Viewing all articles
Browse latest Browse all 4756

Trending Articles