This is a problem I have encountered after moving from 7902 to build 8301.
I use this technique fairly often to populate a list control in a UX:
When the UX is opened, an unbound control is populated. The list uses the value in the control as an argument in a sql statement that populates the list.
The list is set to "Delay Render until Explicit Refresh".
The unbound control has an Action Javascript in the onChange event that refreshes the list.
The result is that the UX opens and the list displays, and focus is set to the first row in the list.
The problem I am having is that the list is losing focus.
I have not pinned down the cause but I can re-create it.
Here is a UX with a list based on the Northwinds customer list. To use it you'll have to change the connection string in the list.
TestFocus.zip
Here is are some more details:
I made a List1 control with detail view.
I mapped a detail view control: ContactName
I unchecked Allow Null Selection.
Capture Focus is checked by default.
I added an unbound control: CustomerID
Works fine so far
I added an Action Javascript Refresh Data to the onChange of CustomerID control with default settings in the builder.
In the list control I checked Delay Render until Explicit Refresh.
I added a button labeled Populate CustomerID, with this in the click event
I added an argument WHATCUSTOMERID. Value is derived from CustomerID control.
I added WHERE CustomerID = :WHATCUSTOMERID to the sql statement that populates the list control.
Works fine so far. When I click the button the list is populated with one row and focus is on the row.
I added this to client-side event onRenderComplete:
Now the list is populated with one row, the row gets focus, but then a split second later the list loses focus.
When {dialog.Object}.setValue('CustomerID','CENTC'); is excecuted in onRenderComplete, focus is lost.
When {dialog.Object}.setValue('CustomerID','CENTC'); is executed from a button, focus remains.
** Sometimes in Live Preview and Working Preview the value disappears from CustomerID and the list never gets populated. But this does not happen in a browser.
Note that the focus problem does not happen in a list with no detail view.
Can anyone figure out what is happening here?
I use this technique fairly often to populate a list control in a UX:
When the UX is opened, an unbound control is populated. The list uses the value in the control as an argument in a sql statement that populates the list.
The list is set to "Delay Render until Explicit Refresh".
The unbound control has an Action Javascript in the onChange event that refreshes the list.
The result is that the UX opens and the list displays, and focus is set to the first row in the list.
The problem I am having is that the list is losing focus.
I have not pinned down the cause but I can re-create it.
Here is a UX with a list based on the Northwinds customer list. To use it you'll have to change the connection string in the list.
TestFocus.zip
Here is are some more details:
I made a List1 control with detail view.
I mapped a detail view control: ContactName
I unchecked Allow Null Selection.
Capture Focus is checked by default.
I added an unbound control: CustomerID
Works fine so far
I added an Action Javascript Refresh Data to the onChange of CustomerID control with default settings in the builder.
In the list control I checked Delay Render until Explicit Refresh.
I added a button labeled Populate CustomerID, with this in the click event
Code:
{dialog.Object}.setValue('CustomerID','CENTC');
I added WHERE CustomerID = :WHATCUSTOMERID to the sql statement that populates the list control.
Works fine so far. When I click the button the list is populated with one row and focus is on the row.
I added this to client-side event onRenderComplete:
Code:
{dialog.Object}.setValue('CustomerID','CENTC');
When {dialog.Object}.setValue('CustomerID','CENTC'); is excecuted in onRenderComplete, focus is lost.
When {dialog.Object}.setValue('CustomerID','CENTC'); is executed from a button, focus remains.
** Sometimes in Live Preview and Working Preview the value disappears from CustomerID and the list never gets populated. But this does not happen in a browser.
Note that the focus problem does not happen in a list with no detail view.
Can anyone figure out what is happening here?
Comment