0

I have a grid called myGrid. The column A of myGrid is a lookup that shows 2 values: the code, and the description. I would like to copy the selected item's description into a second column of myGrid.

What would be the best way to do this?

Piotr
  • 5,543
  • 1
  • 31
  • 37
stighy
  • 7,260
  • 25
  • 97
  • 157

2 Answers2

0

I have encountered this sometimes ago and the solution I found is a bit complicated but works fine. I had to create a form from scratch which is currently used in the lookup. When calling the form in the lookup() method, don't forget to put "element" in the arguments.

In the init method of the new form, use element.selectMode(YourTable.Code) to specify which field will be selected. Override the closeSelect() method of the new form and make it call a parm method located in the caller form. This parm method will set the YourTable.Description field of the current record. Send the Description related to the record from YourTable selected by the user in the lookup.

The new form should be a window of type Popup, with the toolbar hidden and always on top. Its datasource should be YourTable.

Call the new form from the lookup method (or better, from a method at the table level called from the lookup method) using ClassFactory.formRunClass(args).

Max
  • 3,453
  • 3
  • 32
  • 50
0

I found a 'simple' solution: i've to simply override the method modifieldfield

stighy
  • 7,260
  • 25
  • 97
  • 157
  • If the PK constraint is on the Code field it works flawlessly but if you can have multiple lines with the same value in Code's fields but with different description (i.e. if the PK constraint is on both fields) it won't work. – Max Jul 17 '12 at 09:38