Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to set up an array of objects properly for user inputed data
    primarykey
    data
    text
    <p>Im setting up a gallery viewer that runs off rss feeds in javascript, i'm trying to lessen the burden of knowledge on the user of the application to as minimal as possible. There is a separate javascript file that holds all the custom data separately from the application, the array of objects is then extended by the default parameter object so that the user only has to enter what variables they want to change for each gallery, but a new object must be created for each to at least enter the rss path.</p> <p>currently the default variable looks some like</p> <pre><code>var default = { id:'x', path:"", row:1, col:5 (etc)} </code></pre> <p>I have set up the customVars script so the custom data is an array of objects that looks like this</p> <pre><code>var customVars = [ albumList = { path :"http://", displayType : "list" }, album1 = { path : "http://", rows : 1 , col : 6 } ]; </code></pre> <p><strong>EDIT(important)</strong>- i need to be able to traverse the customVars data in an efficient manner, specifically when i dont know the name of the album objects they create- in other words, customVars[1].rows needs to be able to return 1</p> <p>is this the proper way to accomplish this? am i going to run into weird errors down the line, or is there a better way to accomplish this maybe? is it ok to declare objects like that inside the array( i was trying to avoid having the user declare the variables and then have them set up the array themselves</p> <p><strong>EDIT2</strong></p> <p>changed it to an array of objects and added to variable id inside the parameter list, which seems to be working ok for now- still not sure if i can declare objects in this manner, but i need to be able to iterate through the list of objects</p> <pre><code>var customVars = [ { id : 'album0', path : "https://", rssType : "picasaAlbum" , displayType : "list" }, { id : 'album1', path :"https://", rows : 1 , collumns : 5 } ]; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload