How to create a child row and place the user in a cell to ed

Posted by MGreenwood on 04-Mar-2011 07:13

Hello,

We are running under OE 10.2.

We have a grid with 2 bands. We bind data to the grid by  creating a query from a dataset. Then assigning a binding source to the grid. In this way we create our  parent/child relationship in the grid

      hDateRoomCabinQuery = DATASET dsBO_Room:HANDLE:TOP-NAV-QUERY(1).

      hDateRoomCabinQuery:QUERY-PREPARE("PRESELECT EACH ttBO_Room").

      hDateRoomCabinQuery:QUERY-OPEN.     

      THIS-OBJECT:uGridServiceAttributes:Enabled = TRUE .

              

      /*This is done once */  

      IF uGridServiceAttributes:DataSource = ? THEN

      DO:

        THIS-OBJECT:bindingSourceRoomStockDate = NEW Progress.Data.BindingSource

                     (DATASET dsBO_Room:HANDLE, /* INPUT dataset-hdl AS HANDLE */

                      "ttBO_Room",              /* INPUT parent-buffer-name AS CHARACTER | INPUT parent-buffer-hdl AS HANDLE */

                      "*",                      /* INPUT include-fields AS CHARACTER, */

                      "").                      /* INPUT except-fields AS CHARACTER i.e. do not display the following fields*/

                     

        uGridServiceAttributes:DataSource = THIS-OBJECT:bindingSourceRoomStockDate.

The data set has two tables

DEFINE DATASET dsBO_Room

  FOR ttBO_Room, ttBO_BoardBasis, ttBO_CabinData

  DATA-RELATION FOR ttBO_Room, ttBO_CabinData    RELATION-FIELDS(ttBO_Room.RoomKey, ttBO_CabinData.RoomKey) NESTED.

We are adding rows by creating a new temp table record  (ttBO_CabinData) .

The new row is then visualised in the grid by closing  (hDateRoomCabinQuery:QUERY-CLOSE)   and opening (hDateRoomCabinQuery:QUERY-OPEN)  the query.

Firstly how can I place the user in the newly created row in edit mode ?

Secondly if there are entries in the child browse the new row is visible. If there are no entries in the browse the row is not visible but a plus button [+] appears next to the parent. How can I expand this instance of the child browse?

Thanks

All Replies

Posted by Admin on 04-Mar-2011 11:04

Firstly how can I place the user in the newly created row in edit mode ?

 

Look at the PerformAction method of the Grid.

If I'm not mistaking, something like

ultraGrid1:PerformAction (Infragistics.Win.UltraWingrid.UltraGRidAction:EnterEditMode, FALSE, FALSE).

should work.

Posted by Wouter Dupré on 04-Mar-2011 11:09

Hi,

Thank you for your email. I'm currently out of the office on vacation. I will return on March 8. During my absence I will have no access to my email. For urgent matters, call me on my mobile and leave a message on my voice mail or call our office.

Best regards,

Wouter

--

Wouter Dupré

Senior Solutions Consultant

Progress Software NV

Stocletlaan 202 B| B-2570 Duffel | Belgium

Office +32 (0) 15 30 77 00 | Mobile +32 (0) 478 50 00 49 wdupre@progress.com

Posted by MGreenwood on 14-Mar-2011 06:45

Hi Mike,

Thanks for the suggestion, having eventually reached the point where I have

  • added a child row
  • the child row is displayed at the top of the grid  to the user and
  • the child row has been made active

I have applied  the suggestion you made.

THIS-OBJECT:uGridServiceAttributes:PerformAction(Infragistics.Win.UltraWingrid.UltraGridAction:EnterEditMode, FALSE, FALSE ) .

The first column in the child grid is an editable cell, unfortunately it does not place the cursor in that cell ready for editing. Nor have I yet been able to find any other property or method to enable me to achieve the desired result.

Posted by danielStafford on 15-Mar-2011 20:12

Did you try setting the active cell?

I have a button with toolClick code similar to the following:

     Grid:Focus.

     Grid:DisplayLayout:Bands[0]:AddNew().

     Grid:ActiveCell = Grid:ActiveRow:Cells["nameOfCell"].

     Grid:PerformAction(UltraGridAction:EnterEditMode).

Posted by MGreenwood on 16-Mar-2011 04:24

HI Daniel,

Thanks for the suggestion and yes the added child cell has been made active.

Posted by Admin on 17-Mar-2011 03:06

THIS-OBJECT:uGridServiceAttributes:PerformAction(Infragistics.Win.UltraWingrid.UltraGridAction:EnterEditMode, FALSE, FALSE ) .

 

Hi Michael,

what's your CellActivation property set to? I've looked into our updatable browser class and we do:

1.) Set enabled cells Activation property to Activation:AllowEdit (we do that at runtime because we support a different list of updatable columns for update and add

2.) Set the ActiveCell

3.) call the Focus () method of the Grid

4.) do the above PerformAction call.

Posted by MGreenwood on 17-Mar-2011 05:06

Go on Mike give me a clue. . .  How do I find the CellActivation property in the property list OR how can I message this property out?

Without checking it I would guess that it is the default value (whatever that is)

I have tried to set it in the place we set the header details by

uGridServiceAttributes:ActiveCell:Activation = Infragistics.Win.UltraWinGrid.Activation:AllowEdit  .

But that generates a

Lead attributes in a chained-attribute expression (a:b:c) must be type HANDLE or a user-defined type and valid (not UNKNOWN). (10068)

GOT IT !  - Thanks Mike

After setting the Row as active, I have now set a specific cell as active

/*Create a variable to hold a row  value*/

DEFINE VARIABLE lvuGridRowID             AS Infragistics.Win.UltraWinGrid.UltraGridRow NO-UNDO.

  lviChildCount = uGridServiceAttributes:activerow:ChildBands[0]:Rows:count NO-ERROR.
  /*Looping round all of the child rows for a parent row */
  DO lvitem = 1 TO lviChildCount:
    lvcCabin = uGridServiceAttributes:activerow:ChildBands[0]:Rows:Item[lvitem - 1]:cells:item["cabin-number-kd"]:value:ToString().
    /*Until the newly created row is found*/
    IF lvcCabin = "0":U  THEN
    DO:
       
        lvuGridRowID = uGridServiceAttributes:activerow:ChildBands[0]:Rows:Item[lvitem - 1] NO-ERROR.


        /*Make this row the active row - Make the cabin number the active cell*/

        lvuGridRowID:Activate() NO-ERROR.

        lvuGridRowID:Cells:Item["cabin-number-kd"]:Activate() NO-ERROR.

    END.

  END.

 
  /*Expand the active row (in case it has been created unexpanded) */        
  uGridServiceAttributes:PerformAction ( Infragistics.Win.UltraWinGrid.UltraGridAction:ExpandRow ).
        
  /*Call the Focus Method of the grid*/
  uGridServiceAttributes:Focus().
        
  /*Set the active row ready for editing */
  uGridServiceAttributes:PerformAction ( Infragistics.Win.UltraWingrid.UltraGridAction:EnterEditMode, FALSE, FALSE ) .

Posted by Admin on 17-Mar-2011 09:56

Go on Mike give me a clue. . .  How do I find the CellActivation property in the property list OR how can I message this property out?

We do that regardless of the active cell for the Columns, but for individual cells should be o.k. as well.

uGridServiceAttributes:DisplayLayout:Bands[0]:Columns[i]:CellActivation = Infragistics.Win.UltraWinGrid.Activation:AllowEdit.

For i, use an integer zero based index or a character for the Column name (= field name).

This thread is closed