Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Adding and deleting attributes from a javascript object

 
Bryce Martin
Ranch Hand
Posts: 269
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Right now I create my objects manually based on some condition... Something like this...

if (some condition)
columnModel = [{name:'order',index:'order asc', width:70, align:"center"},{name:'job',index:'job',width:300,align:'right'}]

What I want to be able to do is insert or delete from that object. Is there a way to do this? I want to be able to delete the {name:'job',index'job',width:300,align:'right'} piece if a particular condition is met and add others if other conditions are met...

Am I clear? Is this possible?

Thanks
Bryce
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64188
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's not just an object, but an array of objects. Are you talking about removing array entries? You can null them out pretty simply. If you want to manipulate the array further, here's a referecne to array methods. (The splice() method may be what you are looking for).
[ May 19, 2008: Message edited by: Bear Bibeault ]
 
Bryce Martin
Ranch Hand
Posts: 269
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Bear. I brain farted on this. My coffee didn't work very well this Monday morning (it was a busy weekend with little rest). Thanks for the link. Have a great day.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64188
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Repeat after me: never post before caffeine, never post before caffeine...
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic