How do you ensure synchronisation between two %ZEN.Component.tablePane objects?
TablePane1 is populated when a %ZEN.Component.button on a form is clicked from a JavaScript onclick method.
<button caption="Search" onclick="zenPage.onSubmit();"
TablePane1 also has a JavaScript onselectrow method zenPage.onSelectRow() that gets the currently selected RowID.
onselectrow="zenPage.onSelectRow()"
This JavaScript method gets the RowID and feeds it into ClassMethod GetAuditLogs(ByRef pRowId) [ ZenMethod ] to get the audit events for that record.
ClientMethod onSelectRow() [ Language = javascript ] { var table=zenPage.getComponentById('table1'); var dataRow=table.getRowData(table.selectedIndex); var rowID = zenPage.GetSelectedRowId(dataRow.Col1,dataRow.Col2,dataRow.Col3); if (rowID) { zenPage.GetAuditLogs(rowID); } }
The audit events are stored in a global and sorted by $H date/time value. This global is mapped to a %Persistent class using a SQLStorage strategy and is re-created every time a new row is selected in TablePane1. The following method is called to populate the contents of TablePane 2
ClientMethod populateAuditEvents() [ Language = javascript ] { var table=zenPage.getComponentById('auditEventsTable'); table.setHidden(false); table.executeQuery(); }
The problem is that although the globals are being created correctly when a row is selected, there are times when the selected row in TablePane1 is not refreshing the contents of TablePane2. Below is a list of the attributes for TablePane2 (auditEventsTable).
<tablePane id="auditEventsTable" maxRows="1000" width="1000px" showRowNumbers="false" showZebra="true" useSnapshot="false" extraColumnWidth="5%" rowSelect="false" valueColumn="ID" initialExecute="false" hidden="true" sql="SELECT EventDescription, StaffName, Date, Time FROM AuditResults" > <column header="Description" colName="EventDescription" width="40%"/> <column header="Staff" colName="Staff" width="20%"/> <column header="Date" colName="Date" width="9%"/> <column header="Time" colName="Time" width="9%"/> </tablePane>
Does anyone have any idea what could be the problem?