Click here to Skip to main content
15,868,419 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to create a dataset dynamically using JavaScript.
JavaScript
var ds = new Object();
for (i = 0; i < myArray.length; i++) {
  ds.add ( { Id: myArra[i].Id, City: myArray[i].City } );
}

But it does not work. How to add/push items into the dataset dynamically? Thanks if you can help.
Posted
Comments
Thanks7872 21-Nov-14 12:08pm    
Javascript doesn't have anything like Dataset. I would strongly recommend you to learn what is Javascript.
s yu 21-Nov-14 12:29pm    
Please go thru. this http://www.codeproject.com/Articles/30584/Javascript-Dataset-Data-Repeater-and-Grid. Thanks.
Thanks7872 21-Nov-14 12:36pm    
Javascript doesn't have such thing. It is something which is worked out by him. Go through this and implement it.
s yu 21-Nov-14 12:57pm    
I also understand that. The author has a .js file, but in the .js, there is no method to add items. Thanks.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900