Announcement

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

    Can't copy data with ctrl-c out of ListGrid when setCanSelectCells(true)

    GWT Version: 2.9.0
    SmartClient Version: v12.1p_2021-06-16/EVAL Deployment (expires 2021.08.15_07.18.25)
    Browser: All. Mostly tested w/Chrome
    OS: All. Mostly tested on macOS
    SuperDevMode and Compiled mode




    Hi,

    I have an application with a ListGrid. When navigating the ListGrid with the keyboard, I would expect ctrl-c to copy the selected cell value. It does not.

    I've attached the complete source code to a sample application. Please let me know if I should post a jar or something like that.

    Thanks!



    Code:
    package com.clearwateranalytics.bugjar.client;
    
    import com.google.gwt.aria.client.Roles;
    import com.google.gwt.core.client.EntryPoint;
    import com.smartgwt.client.types.SummaryFunctionType;
    import com.smartgwt.client.util.SC;
    import com.smartgwt.client.widgets.grid.ListGrid;
    import com.smartgwt.client.widgets.grid.ListGridField;
    import com.smartgwt.client.widgets.grid.ListGridRecord;
    import com.smartgwt.client.widgets.layout.VLayout;
    
    public final class BugJarEntryPoint implements EntryPoint {
    
        public void onModuleLoad() {
            SC.setScreenReaderMode(true); //accessibility, keyboard navigation
    
            VLayout layout = new VLayout();
            layout.setWidth100();
            layout.setHeight100();
            layout.setPadding(20);
            layout.setAriaRole(Roles.getApplicationRole().getName());
    
            ListGrid grid = createListGridWithCannedData();
            layout.addMember(grid);
            layout.draw();
        }
    
        private static ListGrid createListGridWithCannedData() {
            ListGrid grid = new ListGrid();
            grid.setShowAllRecords(true);
            grid.setFields(getTestFields());
            grid.setData(getTestRecord());
    
            grid.setCanSelectCells(true);
    // grid.setCanDragSelectText(true); // With this on, I can drag select the text, and right-click to copy, but ctrl-c still doesn't work
            return grid;
        }
    
        private static ListGridRecord[] getTestRecord() {
            ListGridRecord records[] = new ListGridRecord[3];
    
            records[0] = new ListGridRecord();
            records[0].setAttribute("field1", 1);
            records[0].setAttribute("field2", 2);
            records[0].setAttribute("field3", 3);
    
            records[1] = new ListGridRecord();
            records[1].setAttribute("field1", 10);
            records[1].setAttribute("field2", 20);
            records[1].setAttribute("field3", 30);
    
            records[2] = new ListGridRecord();
            records[2].setAttribute("field1", 100);
            records[2].setAttribute("field2", 200);
            records[2].setAttribute("field3", 300);
    
            return records;
        }
    
        private static ListGridField[] getTestFields() {
            ListGridField[] fields = new ListGridField[3];
    
            fields[0] = new ListGridField("field1", "Column 1");
            fields[1] = new ListGridField("field2", "Column 2");
            fields[2] = new ListGridField("field3", "Column 3");
    
            return fields;
        }
    }
    Last edited by dhoch; 16 Aug 2021, 13:54.
Working...
X