Hi Jay
The problem, I think, is that the execute() is async so it goes off an takes some time to execute – and so the JS does not stop so the selectRow() fires while the table is empty :{
What is needed is for ISC to add a call back that fires when the table execute has finished
I have done this myself by sub-classing the tablepane
Class Component.TablePane Extends %ZEN.Component.tablePane [ System = 3 ]
{
Parameter NAMESPACE = "http://www.xisltd.net/zenapp";
Property onRefreshContentsUser As %ZEN.Datatype.eventHandler;
ClientMethod onRefreshContents() [ Language = javascript ]
{
this.invokeSuper('onRefreshContents',arguments);
if ('' != this.onRefreshContentsUser) {
go = zenInvokeCallbackMethod(this.onRefreshContentsUser,this,'onRefreshContentsUser');
}
that I have hooked into the built in onRefreshContents to add the call-back
I have to invoke the super ‘cos this stops the progress bar
So I can then have
<xis:tablePane
…
…
onRefreshContentsUser=”zenPage.do_some_fiddling_with_the_table()”
/>
= =
You also need to be aware that setting the selected row will fire the onrowselect, is there is one, which may have undesired consequences
:}
Peter
--
You received this message because you are subscribed to the Google Groups "InterSystems: Zen Community" group.
To post to this group, send email to InterSys...@googlegroups.com
To unsubscribe from this group, send email to InterSystems-Z...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/InterSystems-ZEN?hl=en
Zen Community Terms and Conditions: http://groups.google.com/group/InterSystems-ZEN/web/community-terms-and-conditions
---
You received this message because you are subscribed to the Google Groups "InterSystems: Zen Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to intersystems-z...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hi Jay
A Sync *can*work but it depends how long the query takes – in your example if it takes longer than 200 millisec then it will fail.
Never had to fiddle with the rowcount so can’t comment
Glad you have got it working
Peter
--
Are you using a custom query, on Execute or somesuch? If so, are you filling in the queryInfo object?
~Derek
From: intersys...@googlegroups.com [mailto:intersys...@googlegroups.com]
On Behalf Of Jay Ayliff
Sent: Wednesday, October 01, 2014 4:10 AM
To: intersys...@googlegroups.com
Subject: [InterSystems-Zen] Re: tablePane: After calling executeQuery() rowCount() returns zero, getRowData(0) returns null, selectRow(0) does not select a row.
Hi Vlado,
--
I think I wasn’t clear – (and after doing some review, my comment probably was not as relevant as I thought it was anyway). I have another draft answer that now seems to be completely irrelevant. Let’s try again…
You should be able to reproduce the problem with a simple query that is executed with different parameters from the page after the page has already been rendered. If you still want to report this to development(prodlog) please add me to the cc list and reply to the list with the prodlog reference , otherwise, I’d be happy to create the bug report.
Analysis:
rowCount *should* always be set by the time onRefreshContents() and then the onrefresh callback is called.
Unfortunately the server DOM changes have not yet been copied to the client because the data is fetched, the html is drawn, and the callbacks are made all from one place before the Zen Engine gets a chance to do any DOM updates.. This causes a problem when refreshing a query because the callbacks are invoked before the server performs the object synchronization, and %DrawTable updates the ..rowCount serverside property without setting the client property, so the client side callbacks don’t see the new property values.
The tablePane onRefreshContents(), onrefresh logic therefore cannot make use of the client rowCount property without using zenDeferred (or some other queuing mechanism) being used.
I think that the onRefresh callbacks, should probably be moved to the renderContents mechanism (which is where client-side rendering normally occurs), since this is called *after* DOM synchronization, alternatively the %DrawHTML code would have to set the client properties directly, or pass them as arguments to onRefreshContents() and the onrefresh callback.
Or – Zen applications should use a client-side table widget and use the jsonSQLProvider to get the data!
~Derek
From: intersys...@googlegroups.com [mailto:intersys...@googlegroups.com]
On Behalf Of Jay Ayliff
Sent: Wednesday, October 01, 2014 8:43 AM
To: intersys...@googlegroups.com
Subject: [InterSystems-Zen] Re: tablePane: After calling executeQuery() rowCount() returns zero, getRowData(0) returns null, selectRow(0) does not select a row.
Hi Derek,
--
Hi, Jay.
You might try the following:
1. Define an onrender callback for your tablePane pointing at the original onrefresh logic
2. Change the onrefresh logic to set the client render flag – hopefully this will cause Zen to invoke the original onrefresh logic after the change to the rowCount property has been synchronized
If that works, please update the bug report, since Zen could be modified to do this automatically (calling the onrefresh handler from renderContents() before invoking any existing onrender handler.
HTH,
Derek
From: intersys...@googlegroups.com [mailto:intersys...@googlegroups.com]
On Behalf Of Jay Ayliff
Sent: Thursday, October 02, 2014 4:31 AM
To: intersys...@googlegroups.com
Subject: [InterSystems-Zen] Re: tablePane: After calling executeQuery() rowCount() returns zero, getRowData(0) returns null, selectRow(0) does not select a row.
Hi Peter,