Connecting Tech Pros Worldwide Help | Site Map
 
 
LinkBack Thread Tools Search this Thread
  #1  
Old September 1st, 2008, 03:45 PM
sheldonlg
Guest
 
Posts: n/a
Default Problem with Javascript with TDC control

I have inherited code with a TDC control. In this file, there are two
javascripts of interest. One of these is a function, filter(), which is
inside
<script language=javascript></script>.

The other is code inside
<script language=javascript FOR=inquiry
event=ondatasetcomplete()></script>
where inquiry is the TDC.

The table displays correctly. The problem is in getting the total after
doing a display and then refreshing the TDC (which invokes the script
filter() ). That calculation is done in the second script. What
happens in there is:
var rs = inquiry.recordset;
extcosttot = 0;
num = rs.Fields.Count;
while(rs.EOF != true)
{
extcosttot += parseFloat(rs(9).value);
rs.moveNext;
}

When I alert inside the while loop, the very first record from before
the sorting -- even though the table display properly with the new one.

I tried to put similar looping code at the end of filter() to examine
what I get from the TDC refresh, but I got a messages of "Operation is
not allowed when the object is closed". When I added an open() for I
got "The connection cannot be used to perform this operation. It is
either closed or invalid in this context".

I am at a bit of a loss. I have no idea what happens between the end of
filter() and the inline script and I have no idea on how to
successfully put in code to see what is at the end of filter().

Since there is no code in the generator file for how the sorting is
taking place, the problem must be after retrieving the recordset,
observing somehow that it was left at a certain column being sorted, and
then sorting it accordingly.



  #2  
Old September 2nd, 2008, 01:05 PM
sheldonlg
Guest
 
Posts: n/a
Default Re: Problem with Javascript with TDC control

sheldonlg wrote:
Quote:
I have inherited code with a TDC control. In this file, there are two
javascripts of interest. One of these is a function, filter(), which is
inside
<script language=javascript></script>.
>
The other is code inside
<script language=javascript FOR=inquiry
event=ondatasetcomplete()></script>
where inquiry is the TDC.
>
The table displays correctly. The problem is in getting the total after
doing a display and then refreshing the TDC (which invokes the script
filter() ). That calculation is done in the second script. What
happens in there is:
var rs = inquiry.recordset;
extcosttot = 0;
num = rs.Fields.Count;
while(rs.EOF != true)
{
extcosttot += parseFloat(rs(9).value);
rs.moveNext;
}
>
When I alert inside the while loop, the very first record from before
the sorting -- even though the table display properly with the new one.
>
I tried to put similar looping code at the end of filter() to examine
what I get from the TDC refresh, but I got a messages of "Operation is
not allowed when the object is closed". When I added an open() for I
got "The connection cannot be used to perform this operation. It is
either closed or invalid in this context".
>
I am at a bit of a loss. I have no idea what happens between the end of
filter() and the inline script and I have no idea on how to
successfully put in code to see what is at the end of filter().
>
Since there is no code in the generator file for how the sorting is
taking place, the problem must be after retrieving the recordset,
observing somehow that it was left at a certain column being sorted, and
then sorting it accordingly.
I worked my way around to avoid the problem (not by fixing it), but I
would still like to know what caused this problem in the first place.

The call of a filter is done in a javascript routine with setting the
DataURL and doing inquiry.Reset() where inquiry is the name of the
dataset object. When it is complete, it calls another javascript (via
using ondatasetcomplete). The getting of this refreshed dataset has no
knowledge of any sorting that may have taken place on the columns prior
to doing the refresh, and the ondatasetcomplete is done automatically
upon getting the refreshed data.

What I would like to know is this:
*************
Why does the looping through the dataset give all the proper records
(sorted) except for the first record which is from the unsorted set?
*************

For anyone who may be interested, the way I avoided the problem was to
add an extra field to the dataset. In the display page, I set the style
of that column to "display:none". In that field, I place the cumulative
total for all the records, and all records hold the same total. In the
DataURL, I delayed writing of the records by putting them into an array,
and at the end of the fetching, modifying all the lines in the array by
setting the same cumulative total into that last field. Then I print out
the entire array in the appropriate format.
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 205,414 network members.