I think the real problem here is that the clear_selection method ( or whatever its called ) always checks to see if the page has reloaded. This is so javascript onChange, onCLick events that cause a page reload get executed correctly. ( think of a page with several select lists, pick a country in the first, page reloads and populates the next with state, etc )
In one of the previous controllers I had the same problem - the script took ages to run cos of this continual checking. I added a optional parameter to tell the controller to not bother with the wait if I knew there was no javascript. So in this case we could have Ie.select_list(;index,1).clear_selection( true ) Where there is a default that tells the method to wait, but it can also not wait by setting the parameter to true. This is pretty easy to add, and is much less work than implementing Bret new select_list code. Paul -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Bret Pettichord Sent: 14 July 2005 09:07 To: [email protected] Subject: RE: [Wtr-general] ClearSelection Tuyet, I think the root problem is that there are two kinds of select elements -- multi-select and single select. We only have one class to support them, and therefore pretty much assume it is multi-select, since the methods you use with it also work for single select -- but sometimes they are less efficient. I'm not sure if the best solution isn't to create two different classes, but this would amount to even more rework then just adding option objects. In the mean time, i suggest you work directly with the OLE object. Here are a couple things to try: ie.frame("customizeRemoteContent").select_list(:id, "availableColumnsSelectBox").getOLEObject.selectedIndex = -1 ie.frame("customizeRemoteContent").select_list(:id, "availableColumnsSelectBox").getOLEObject.value = "" If neither of these work, refer to this for more information regarding the OLE interface: http://msdn.microsoft.com/workshop/browser/mshtml/reference/ifaces/selec telement/selectelement.asp Let us know what works for you. Bret At 09:35 PM 7/13/2005, Paul Rogers wrote: >"urn:schemas-microsoft-com:office:office" xmlns:w = >"urn:schemas-microsoft-com:office:word"> >this looks like a perfect situation for Bret new select_list scheme - you >could do this > >ie.select_list(:name, 's').option(:value, 'v2').clear > >So Bret, maybe we should add it soon ? > >Paul > > >-----Original Message----- >From: [EMAIL PROTECTED] >[mailto:[EMAIL PROTECTED] On Behalf Of Tuyet Cong-Ton-Nu >Sent: 13 July 2005 19:32 >To: '[email protected]' >Subject: [Wtr-general] ClearSelection > >How can I clear a selection that was previously selected? >1) Selecting this item works fine >irb(main):012:0> ie.frame("customizeRemoteContent").select_list(:id, >"availableC >olumnsSelectBox").select("-Descriptive Data") >=> nil > >2) But clearing it seems to not work >irb(main):013:0> ie.frame("customizeRemoteContent").select_list(:id, >"availableC >olumnsSelectBox").select("-Descriptive Data").clearSelection >NoMethodError: undefined method `clearSelection' for nil:NilClass > from (irb):13 > from ¢¾:0 > >3) This works too but it takes over 20 seconds since my select box has >lots of items >so it¡¯s too long to use in a script >ie.frame("customizeRemoteContent").select_list(:id, >"availableColumnsSelectBox").clearSelection > >That¡¯s why I need to be able to clearSelection for a particular item >rather than for the entire select box > >Any idea how to make #2 work? >_______________________________________________ >Wtr-general mailing list >[email protected] >http://rubyforge.org/mailman/listinfo/wtr-general _____________________ Bret Pettichord www.pettichord.com _______________________________________________ Wtr-general mailing list [email protected] http://rubyforge.org/mailman/listinfo/wtr-general _______________________________________________ Wtr-general mailing list [email protected] http://rubyforge.org/mailman/listinfo/wtr-general
