This week's book giveaways are in the Angular and TypeScript and Web Services forums.
We're giving away four copies each of Programming with Types and The Design of Web APIs and have the authors on-line!
See this thread and this one for details.
Win a copy of Programming with Types this week in the Angular and TypeScript forum
or The Design of Web APIs in the Web Services forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Henry Wong
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Frits Walraven
  • Joe Ess
  • salvin francis

Urgent !! Deleting elements from Combo Box

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I need to delete a few elements from my combo box based on certain condition. I'm able to add contents into Combo Box at run-time using OPtion object but not able to delete.
How can I go about doing this ... plz guide me
Thanking u in advance,
Aman
 
Ranch Hand
Posts: 3244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Aman
I assume your using the options array to add the new items to your list. To delete and item just set its index to null. If you have a list named myList do this:
myList.options[2] = null;
This will remove the 3rd item from the options array and also compress the array. If the original options were 'item1, item2,item3,item4' after the above line it would now be:
'item1,item2,item4'
hope that helps
Dave

PS you'lleed to refresh the page to get the actual list on the screen to change. history.go(0); works but it must be the last thing you do.
 
Aman Rustogi
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thx Dave.
But i guess i cannot refresh the page as it contains hell lot of data.
Newayz thx for providing the tip !!
aman
 
Ranch Hand
Posts: 328
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Just a suggestion here, but if the form/page contains a lot of data it might be more userfriendly to break it down into several small steps which are presented/filled in separately.
This way the user might feel it's less tedious and you could do your refresh and have more dynamic content!

Terry
 
Get me the mayor's office! I need to tell him about this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!