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
  • 1.  "click on first column of datagrid" event

    Posted Sun February 22, 2015 09:08 AM

    Hello I have implemented a datagrid like the tutorial :

      allPayments_ui DataGrid{layoutData = new GridLayoutData{row = 2, column = 1, verticalAlignment = GridLayoutLib.VALIGN_TOP},selectionListeners ::= cellClicked, headerBehaviors =[],  columns =[
                        new DataGridColumn{name = "category", displayName = "Type", formatters =[formatCategory
                                ]},
                        new DataGridColumn{name = "description", displayName = "Description", width = 120},
                        
                        new DataGridColumn{name = "amount", displayName = "Amount due", width = 85, alignment = DataGridLib.ALIGN_RIGHT}
                        
                ], data = allPayments as any[],

     

     Is it possible to create an event so that if I click on the first column of datagrid  I can add code to resize the width of the column?

     

    Thanks

     

     

    michaeldefox


  • 2.  Re: "click on first column of datagrid" event

    Posted Mon February 23, 2015 02:18 AM

    Hi,

    i think you can do this with the editor behaviors

     

        function EditorBehaviors(grid DataGrid in, cell Widget in, rowData any in, rowIndex int in, column DataGridColumn in, value any in) returns(Widget)
            if(column.name == "first column name")
                TEST_label TextLabel{text = value, onClick ::= do_what_you_want_onClick};
                cell.children =[TEST_label];
            end

    end

    Marcel-D


  • 3.  Re: "click on first column of datagrid" event

    Posted Tue February 24, 2015 04:19 AM

    Thanks for your response,

    I have another question,.

    This implementation can be applied only to each header of datagrid in order to call function only if we click on each header?

     

    Thanks

    michaeldefox


  • 4.  Re: "click on first column of datagrid" event

    Posted Tue February 24, 2015 04:26 AM

    Sorry, but i don't unterstand what you want to do...

    Do you want to call the onClick event in all columns?

    Marcel-D


  • 5.  Re: "click on first column of datagrid" event

    Posted Tue February 24, 2015 04:35 AM

    yes exactly this and if its possible to click only the header of its column (not the cells)  and do something.

    michaeldefox


  • 6.  Re: "click on first column of datagrid" event

    Posted Tue February 24, 2015 04:45 AM

    I don't know if its possible with the header... maybe with the headerBehaviors

    Marcel-D


  • 7.  Re: "click on first column of datagrid" event

    Posted Wed February 25, 2015 02:21 AM

    You could give attached piece of code a try. I guess that's what you mean isn't it?

    To not tamper with the datagrid's default click-header-to-sort function I implemented the header-rightclick to resize the column.

    Regards,

    Guus

     

     

    gweis


  • 8.  Re: "click on first column of datagrid" event

    Posted Fri February 27, 2015 03:44 AM

    This solution was very helpful but I also want each column to return to its default size when I click on the header again or something like that in order to take the initial grid.

     

    I also tried the above solution for the headerBehavior but then i couldn't sort  the columns anymore.

    if(column.name == "first column name")
                TEST_label TextLabel{text = value, onClick ::= do_what_you_want_onClick};
                cell.children =[TEST_label];
            end

     

    Here is my example where i use onMouseOut but as i wrote before the sorting doesn't work

    Thanks

    michaeldefox


  • 9.  Re: "click on first column of datagrid" event

    Posted Fri February 27, 2015 05:45 AM

     

    I added this line and now the column returns to default size onMouseOut event

            cell.onMouseOut ::=format;   in headerBehavior function

    "format is the function to return cell to its default size." 

    but i would like to resize every column  by left clicking the header not right clicking and left click the header  to return to default size of column. Is that possible?

     

    Thanks!!

    michaeldefox


  • 10.  Re: "click on first column of datagrid" event

    Posted Mon March 02, 2015 05:35 AM

    Is this (attached file) what you are looking for?

     

    gweis


  • 11.  Re: "click on first column of datagrid" event

    Posted Mon March 02, 2015 06:42 AM

    Yes, thank you!!

    michaeldefox