Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDNN Open Source...DNN Open Source...Provider and Extension ForumsProvider and Extension ForumsClientAPIClientAPIProblems with CLientAPI and Array.prototypeProblems with CLientAPI and Array.prototype
Previous
 
Next
New Post
6/1/2006 5:13 AM
 

I defined two array utilitiy functions on a javascript file

Array.prototype.unique and Array.prototype.indexOf which i use on my application

The problem is that i have a dnn treview control and when i click the expand/collapse(+/-) it raises an error

the object doesn't support the method

the error is raised on the following piece of code

for (sKey in this.vars)

{

sVals += ROW_DELIMITER + sKey + COL_DELIMITER + this.vars[sKey].replace(re, QUOTE_REPLACEMENT);

}

in the setvar function in dnn.js file(i believe this is a modified version of the setvar function as you suggested in one of my previous posts but i believe it doesn't matter to this issue)

the problem is that in this case the sKey variable through the iteration gets the references of the functions defined by Array.prototype besides its normal strings values, so the this.vars[sKey] and sVals will have these functions bodies in their values which i believe isn't right. 

I solved this by adding the instruction

if(typeof this.vars[sKey] =='string') before adding the this.vars[sKey] value to sVals.

Thanks in advance!

 
New Post
6/1/2006 10:02 AM
 

I suppose that is one solution, until someone decides to further extend the array object with new properties that are strings... 

I am curious what Array.prototype.unique does?  is it a function or a boolean property?

Personally, I don't like extending base objects, for it becomes difficult to get third party scripts to play nice together.  I am not saying I don't do it, but when you run into issues like this I would try and find another solution, for other scripts may enumerate an array in the same manner.


 
New Post
6/1/2006 12:25 PM
 

Both extensions are functions:

unique returns an array with duplicate values removed and indexOf returns the index of a specific element.

If you're interested i found them on this site: http://4umi.com/web/javascript/array.htm

There are also other useful array functions and also implementations of current existent array methods with simple JavaScript code.

At this time i'm not going to extend further any base object so i'll leave the code as is. If it's going to interferes again with some script i'm going to make them simple functions not extension.

Thanks for your response!

 

 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Provider and Extension ForumsProvider and Extension ForumsClientAPIClientAPIProblems with CLientAPI and Array.prototypeProblems with CLientAPI and Array.prototype


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out