EGL Development User Group

EGL Development User Group

EGL Development User Group

The EGL Development User Group is dedicated to sharing news, knowledge, and insights regarding the EGL language and Business Developer product. Consisting of IBMers, HCL, and users, this community collaborates to advance the EGL ecosystem.

 View Only
Expand all | Collapse all

Datagrid no drag and drop some columns

  • 1.  Datagrid no drag and drop some columns

    Posted Fri March 06, 2015 08:14 AM

    I have a datagrid. When i drag and drop my header, columns change position. I want the first 2 columns not to change position. Is there any way to do this?

    xarlap


  • 2.  Re: Datagrid no drag and drop some columns

    Posted Mon March 16, 2015 11:21 PM

    Hi xarlap,

    There is no API to support this. But you can change the DataGrid implementation to achieve this requirement. Open DataGrid.egl, make changes to below functions:

    1. Modify enableDragging() to disable dragging of column 1 and 2

    private function enableDragging()        columnCount int = columns.getSize();        tds Widget[] = grid.getElementsByTagName("span");        count int = tds.getSize();        for(n int from 3 to count)                              //Only enable d&d from column 3            if(tds[n].id like (grid.id + "-header-%"))                        header Widget = tds[n];                        header.onStartDrag = startDrag;                header.onDrag = dragColumn;                header.onDropOnTarget = endDrag;                end          end    end
    2. Modify getTargetColumn() to disable drop to column 1 & 2
    private function getTargetColumn(x int in) returns(int)        columnCount int = columns.getSize();        dx int = ui.x;        for(column int from 1 to columnCount)            w int = 2 * cellPadding + columns[column].width;            if(x > dx && x < dx + w)                if(column <=2 )                        column = 3;                end                return(column);            end                      dx += w;        end    end

    Notice that, these changes are like hacking which is not included in the product. 

    HuangJiYong