HI,
I am looking at this bit of code:
var length = 0;
for (recordId in publicationTableIndexes[sortColumnNumber]){
length++;
}
And I am wondering if there is a way of getting the same result without the loop?
publicationTableIndexes is an array containing 5 arrays. If I try publicationTAbleIndexes[sortColumnNumber].length I get undefined.
Ideas?
Thanks, Ron.
Ok, as per the suggestions I did some testing and realised that the sub element is actually an object. The construcotor code:
function sortTableByCreatingIndex(table, sortingColumnNumber, sortOrder, superTable){
var length = 0;
//Length -1 due to the array doing an upwards comparison, if length not adjusted null object error.
length = table.length - 1;
for (recordId = 0; recordId <= length; recordId++){
this[recordId] = recordId;
}
I actually haven't encountered the 'this' usage before and was quite intrigued by it. What I am interested in knowing how do I take it out and define it as an array. How does 'this' work because looking at the code its not obvious where it is getting its values from, a bit kind of 'like magic' it knows what object to reference.
Thanks, R.