Control Grid Selection Problems

I’m having some problems with Control Grids and the Popup help and knowing which field has been clicked to fire the help popup.

I have a simple example which is highlights my problem, here is a simple page with a Control Grid with 1 Column of Fields which have the popupmethod set to ‘openIdValueComboOrPopup’

and the program which runs this is here and will display three items in the Popup ComboBox

/** Main program generated for
/** adapter <:link MMIT/TEST>.
/*
/** :author mmit
/** :version Generated by Natural for Ajax.
/*
DEFINE DATA LOCAL
1 LINES (1:)
2 FLDGRIDFIELD (A) DYNAMIC
2 SELECTED (L)
END-DEFINE
*
EXPAND ARRAY LINES TO (1:3)
PROCESS PAGE USING “TEST”
*
DECIDE ON FIRST PAGE-EVENT
VALUE U’nat:page.end’
/
Page closed.
IGNORE
VALUE U’lines.findValidValuesForFldGridField’
/
TODO: Implement event code.
PROCESS PAGE UPDATE FULL AND SEND EVENT ‘nat:page.valueList’
WITH PARAMETERS
NAME ‘id’ value ‘1;2;3’
NAME ‘text’ VALUE ‘Option 1;Option 2;Option 3’
END-PARAMETERS
PROCESS PAGE UPDATE FULL
VALUE U’onExit’
/* TODO: Implement event code.
PROCESS PAGE UPDATE FULL
NONE VALUE
/* Unhandled events.
PROCESS PAGE UPDATE
END-DECIDE

When I click on one of the help buttons next to one of the fields a combobox correctly appears with the values. The problem is when a value is then selected, and the Field is updated I cannot tell which one of the Fields has actually been updated as the Selected property does not got set. How can I get round this?

When a value is selected from the dropdown no event is sent, so the user can
select a value for any / all dropdowns and still no event is sent to Natural,
so one or more fields have been modified, but none “selected”.

You will need to set the flushmethod for fldGridField, this will trigger an event,
but be aware that the format of the event actually sent is a bit strange, for
example when you set flushmethod=onFieldChanged the method sent will be

lines.items[n].onFieldChanged

where ‘n’ is the actual index of the modified field.

Hth, best regards,

   Wolfgang

Hi Mitchamm,

To find the line that is selected you need to loop your list and test if selected(i) is true.
Another way is to use the NJX:EVENTDATA.
This returns the index of the line on which you have clicked. Look this up in the documentation.

Best regards,

Jan