Web Framework 18.1
Web Framework Improvements
- Added DD-remember support to WebApp
The needed changes have been made in WebApp to support DD-remember.
The public web DEO methods DDFieldRemember, DDFieldRememberLast, and DDFieldUnRemember have been added to file/field bindable web DEOs. They work just like their window's counterpart. This provides a suggested mechanism for setting dynamic DEO field defaults. This can be end-user controlled or developer controlled.
Just like in Windows, this can be used to set dynamic defaults and retains (via remember-last). When applied to parent autofind fields, the parent will be found during a clear, providing a way to set parent record defaults as well. As in Windows, this is meant to replace the need for using the deprecated Retain and RetainAll.
WebApp.src has an example of a Remember menu group. While this works, it is probably not how you would use this feature. Instead, you will either create buttons next to DEOs that do this or manually set defaults within your code. If you set these manually, you can either send the messages DDFieldRemember, DDFieldRememberLast, and DDFieldUnRemember to the appropriate DEO or you would send remember messages directly to the DDO using Field_RememberedValue, ClearRememberedDefaults, and ClearAllRememberedDefaults.
Retain and RetainAll were not working properly in WebApps and now they are. They should still be avoided. They are supported as legacy DD features.
- Better WebApp DDO Sync behavior during a request resync
WebApps do a more efficient job of re-syncing DDOs and they now properly support diamond relationships.
- Initial support for multi-row lists/grids
The cWebColumn now has pbNewLine, piColSpan, and piRowSpan properties which can be used to make a row display itself over multiple lines. Note that due to this change, the HTML structure of lists and grids changed where each row now consists of a table.
- Optimized list scrolling
Optimized list scrolling by off-loading work to the video card. This is done by using the translateY CSS transformation when supported by the browser.
- Added support for fixed width columns
The column's piWidth value will be interpreted as a pixel value instead of a weight ratio by setting pbFixedWidth to true.
- Fixed the cWebDateForm
Improved support for older browsers and slower machines.
- Fixed the password field issue on mobile devices
Password fields switched back to regular text fields on blur.
- Fixed focus issue on the cWebGroup
The cWebGroup was reporting itself as having the focus like a control while a container shouldn't be able to take the focus.
- Fixed the ShowInfoBalloon function
The function never showed the info balloon immediately while it should.
-
Improved the loading process of dialogs and views
Improved the loading process of dialogs and views so they can be initialized synchronously within the same call. See the new property
pbOverrideStateOnShowoncWebWindowfor more details. -
Fixed the setter of pbEnabled for the cWebList
Fixed the setter of
pbEnabledfor thecWebListin the JavaScript engine which was causing errors if called during initialization. -
Changed the way views and dialogs are loaded
We have changed the way views and dialogs are loaded with the goal to improve initialization of a view/dialog based on parameters. The view now has a new property
pbOverrideStateOnShowwhich controls this new behavior. If this property is set to true, a view/dialog immediately becomes in sync as soon asShowis sent. Instead of going back to the client to see if the view/dialog was already being loaded, it immediately marks the view as being synchronized and performs the necessary operations (check rights, clear DDOs, rebuild constraints). This means that you can now immediately perform finds on the DDOs, and their state will simply override any existing state that might have been on the client already. Thus, we don’t need to store values in web properties and then perform the actual finds inOnShowanymore.Old code:
Object oCustomerDialogOldStyle is a cWebModalDialog Set piColumnCount to 10 Set psCaption to "Customer Maintenance Old Style" Set piWidth to 600 Set piHeight to 400 Set pbOverrideStateOnShow to False Procedure ShowCustomer Handle hoOpeningView RowID riCustomer WebSet psCustomerRowId to (SerializeRowID(riCustomer)) Send Popup hoOpeningView End_Procedure { WebProperty = True } Property String psCustomerRowId "" Set pbServerOnShow to True Procedure OnShow String sRowID WebGet psCustomerRowId to sRowID Send FindByRowId of oCustomer_DD Customer.File_Number (DeserializeRowID(sRowID)) WebSet psCustomerRowId to "" End_ProcedureNow becomes:
Object oCustomerDialogNewStyle is a cWebModalDialog Set piColumnCount to 10 Set psCaption to "Customer Maintenance New Style" Set piWidth to 600 Set piHeight to 400 Set pbOverrideStateOnShow to True Procedure ShowCustomer Handle hoInvokingView RowID riCustomer Send Popup hoInvokingView Send FindByRowId of oCustomer_DD Customer.File_Number riCustomer End_ProcedureAs the code samples show, this simplifies the code quite a lot and reduces the need for web properties to temporarily store the parameters until the next call when the view was actually in sync. It also improves performance by reducing the need for this separate
OnShowcall. Importantly, when a dialog is opened, you won’t see the old values (from its last usage) flashing away into the new values anymore.A small side note is that web properties are not reset to their initial value, so if you change a web property later on, you’ll have to make sure that it is changed back yourself.
The property replaces the
pbClearDDOsAfterHideproperty which was added to prevent old (probably deleted) records from being refound while initializing dialogs. The newpbOverrideStateOnShowalso prevents that from happening. Like the old property,pbOverrideStateOnShowdefaults to false for thecWebViewand to true forcWebModalDialog. The change is backwards compatible so that dialogs initializing with the old way still function properly (regardless of the value ofpbOverrideStateOnShow).Prompt dialogs can also be improved with this new behavior. Instead of waiting for the
OnShowto initialize, they can now do this immediately by augmenting theShowprocedure. The change is illustrated below.Old code:
Set pbServerOnShow to True Procedure OnShow Send InitializePromptList of oPromptList End_ProcedureNow becomes:
Procedure Show Forward Send Show Send InitializePromptList of oPromptList End_Procedure -
Fixed cWebEdit
Fixed
cWebEditwhich didn't perform the field validations when leaving the field. This happened because the key handler was not forwarded to its base class. -
All controls now set their object names
All controls now set their object names as
data-dfobjattributes in the HTML so that the corresponding object can be found while debugging and by the previewer. -
Fixed the cWebImage bug
Fixed the
cWebImagebug where under Chrome it wouldn't show the image ifpsUrlwas set to the same URL twice. -
Fixed a bug in the cWebList
Fixed a bug in the
cWebListwhere havingpbShowLabelset to false andpeLabelPositionset tolpTopcaused JavaScript errors. -
Structs and Arrays support with web properties
Structs and Arrays are now supported with web properties. While the creation of struct and array web-properties is a powerful feature making it easy to store large amounts of data, developers should be aware that the data is sent back and forth with every request/response cycle. This could impact performance. Note that RowId data-types are not supported for any type of web-property including structs and arrays. If you need to store RowIds, serialize them to a string using the
SerializeRowId()function.