| Author |
Adding and deleting attributes from a javascript object
|
Bryce Martin
Ranch Hand
Joined: Nov 19, 2007
Posts: 269
|
|
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
Joined: Jan 10, 2002
Posts: 56224
|
|
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 ]
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Bryce Martin
Ranch Hand
Joined: Nov 19, 2007
Posts: 269
|
|
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
Joined: Jan 10, 2002
Posts: 56224
|
|
Repeat after me: never post before caffeine, never post before caffeine...
|
 |
 |
|
|
subject: Adding and deleting attributes from a javascript object
|
|
|