473,395 Members | 1,613 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Array.length not correct when using TableRowObjects?

Hi,

Small question re the use of an Array.
I'v got an array with x rowObjects in it.
When i get it the type of the container is Array and i can get a hold of
the objects just fine.

owever, how do i get the length of the array?
For container.length does not seem to work.

TIA
Fermin DCG

dacostagomez at gmail.com
Jul 23 '05 #1
4 1502
Ivo
"F Da Costa" wrote
Small question re the use of an Array.
I'v got an array with x rowObjects in it.
When i get it the type of the container is Array and i can get a hold of
the objects just fine.

owever, how do i get the length of the array?
For container.length does not seem to work.


You have misspelled the word length as lenght. Happens all the time.
Or provide some clues by showing us some code.
HTH
Ivo
Jul 23 '05 #2
Ivo wrote:
"F Da Costa" wrote
Small question re the use of an Array.
I'v got an array with x rowObjects in it.
When i get it the type of the container is Array and i can get a hold of
the objects just fine.

owever, how do i get the length of the array?
For container.length does not seem to work.

You have misspelled the word length as lenght. Happens all the time.
Or provide some clues by showing us some code.


Point wel taken. Unfortunately there was no typo.
To make matters worse. When using the Venkman debugger the content of
the object (of type Array) showed the two HtmlRowTableElements just fine
and the parameter length said 0.

Following the code:
....
var ch = getChildSegments(segment, 1);
if (ch.length>0)
displayDirectChildren(ch, onOff);
....

ch is filled correctly as verified in the debugger, breakpoint on the if
line.
The displayDirectChildren function is correct because this line is the
last one in that particular function (recursive call).

TIA
Fermin DCG
Jul 23 '05 #3
F Da Costa wrote:
Ivo wrote: <snip>
Or provide some clues by showing us some code.

<snip> Following the code:
...
var ch = getChildSegments(segment, 1);
if (ch.length>0)
displayDirectChildren(ch, onOff);
...

<snip>

No array is created of filed in this code. The contents of the -
getChildSegments - function would be more relevant, along with the
context in which it is called (i.e. what does - segment - refer to?).

Richard.
Jul 23 '05 #4
F Da Costa wrote:
Ivo wrote:
"F Da Costa" wrote
Small question re the use of an Array.
I'v got an array with x rowObjects in it.
When i get it the type of the container is Array and i can get a hold of
the objects just fine.

owever, how do i get the length of the array?
For container.length does not seem to work.

You have misspelled the word length as lenght. Happens all the time.
Or provide some clues by showing us some code.


Point wel taken. Unfortunately there was no typo.
To make matters worse. When using the Venkman debugger the content of
the object (of type Array) showed the two HtmlRowTableElements just fine
and the parameter length said 0.

Following the code:
...
var ch = getChildSegments(segment, 1);
if (ch.length>0)
displayDirectChildren(ch, onOff);
...

ch is filled correctly as verified in the debugger, breakpoint on the if
line.
The displayDirectChildren function is correct because this line is the
last one in that particular function (recursive call).

TIA
Fermin DCG


ch can exist such that (ch.constructor == Array) evaluates to true, it can
contain information you have placed in it, and still have ch.length == 0.

var a = new Array();
a["a"] = "a";
a["b"] = "b";
alert(a.length);

Without knowing how you are populating ch, it's difficult to tell if this is
the problem or not. For example, you may be doing:

var tableRows = new Array();
tableRows["row0"] = row0;
tableRows["row1"] = row1;
// etc
return tableRows;

In which case, tableRows.length will most certainly be 0.

--
Grant Wagner <gw*****@agricoreunited.com>
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Federico G. Babelis | last post by:
Hi All: I have this line of code, but the syntax check in VB.NET 2003 and also in VB.NET 2005 Beta 2 shows as unknown: Dim local4 As Byte Fixed(local4 = AddressOf dest(offset)) ...
5
by: Denis Perelyubskiy | last post by:
Hello, I need to make an array of elements accross forms. My javascript skills, as evident from this question, are rather rudimentary. I tried to make an associative array and index it with...
22
by: VK | last post by:
A while ago I proposed to update info in the group FAQ section, but I dropped the discussion using the approach "No matter what color the cat is as long as it still hounts the mice". Over the last...
38
by: VK | last post by:
Hello, In my object I have getDirectory() method which returns 2-dimentional array (or an imitation of 2-dimentional array using two JavaScript objects with auto-handled length property - please...
15
by: fdunne2 | last post by:
The following C-code implements a simple FIR filter: //realtime filter demo #include <stdio.h> #include <stdlib.h> //function defination float rtFilter1(float *num, float *den, float...
11
by: truckaxle | last post by:
I am trying to pass a slice from a larger 2-dimensional array to a function that will work on a smaller region of the array space. The code below is a distillation of what I am trying to...
24
by: RyanTaylor | last post by:
I have a final coming up later this week in my beginning Java class and my prof has decided to give us possible Javascript code we may have to write. Problem is, we didn't really cover JS and what...
4
by: mflll | last post by:
I am looking into the different techniques of handling arrays of edit boxes in Java Script. The first program below works fine. However, are there better ways of doing this, where the person...
3
by: Robert Bevington | last post by:
Hi all, I ran into memory problems while tying to search and replace a very large text file. To solve this I break the file up into chunks and run the search and replace on each chunk. This...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.