What We Are Building
We have a customization on the Cases screen that adds a Sub Tasks grid using PXGridWithPreview. Each sub task has a ChatLog field (PXDBText) that stores an HTML chat-style log, and a MessageText field (PXString, unbound) for the user to type a new message. A Send button appends the message to ChatLog and saves it to the database via a PXAction.
The preview panel shows the message input (PXRichTextEdit) and the chat log (PXHtmlView) below it.
The Problem
After clicking Send, the ChatLog in the database updates correctly. However, the PXHtmlView displaying ChatLog in the preview panel does not refresh — it still shows the old content. The user has to click away to another row and come back to see the updated chat log.
What We Have Already Tried
Server side:
CaseSubTasks.Cache.Clear()andCaseSubTasks.Cache.ClearQueryCache()after save- Re-fetching the record via
PXSelectand reassigningCaseSubTasks.Current CaseSubTasks.View.RequestRefresh()
ASPX side:
RepaintControls="All"on the buttonAutoCallBackRepaintControlsIDs="htmlChatLog"explicitly targeting the controlRenderStyle="Simple"on thePXHtmlView- Wrapping
PXHtmlViewin aPXFormViewwith explicitDataMember - Adding
PXTabinside the preview panel with two tabs - Replacing
PXHtmlViewwithPXRichTextEditin readonly mode - Replacing
PXHtmlViewwithPXTextEditin readonly mode (to test binding)
JavaScript side:
- Using
px_all['htmlChatLog'].refresh()viaClientEvents AfterRepaint - Using
px_all['grdAActivities'].selectRow()to force row reselect after send - Hooking
PXCallbackManager.prototype.processCallback— fails withPXCallbackManager is not definedin the iframe context - Intercepting
XMLHttpRequestto detectsubmitMessagecallback and trigger row reselect — causes an infinite loop ofCaseSubTasks$RefreshPreviewcallbacks