Gday eggie5,

I think I know where your problem is. These lines here:

var filter=document.createElement('li');
filter.addClassName('filter');

Your creating an 'li' then trying to add a class name to it by using the 
"addClassName" function.
That function only gets applied to elements when you grab the element 
via the "$" function. By
default, DOM elements dont have that method. So I guess you have a few 
options:

var filter = $(document.createElement('li'));
filter.addClassName('filter');

or

var filter=document.createElement('li');
filter.className = 'filter';

You've also done this with the "a.observe" bit.
I can also see a few other issues you might run into.

var filters=$$('ul.use-filters li.use-filter a');

var filters=$('filters-list');

You are using the same variable name twice. This could potentially break 
you for loop.
You are also not destroying your original sortable, before making a new 
one. This could
cause some ugly memory leaks.

Seeing as your using prototype, you can use .each to loop through your 
filters.
Here is some pseudo code on how it should look.

function SetupListFilters() {
   var filtersList = $('filters-list');
   Sortable.destory(filtersList);
   
   $$('ul.use-filters li.use-filter a').each(function(a, idx)  {
      Event.observe(a, 'click', function(e) {
         //e usually stands for event.
         //el ussually stands for element.
         
         var el = Event.element(e);
         
         var newFilter = document.createElement('li');
         newFilter.className = 'filter';
         
         var newFilterLink = document.createElement('a');
         newFilterLink.appendChild(document.createTextNode(el.innerHTML));
         newFilterLink.appendChild(a);
         
         newFilter.appendChild(newFilterLink);

         filtersList.appendChild(newFilter);
         
         //Because a hasnt been called through the $ function yet,
         // you cannot use .observe.
         
         Event.observe(a, 'dblclick', RemoveFilter);
      });
   }
   
   Sortable.create(filtersList);


Sorry for the long response.
Hope this helps,

Keith.

eggie5 wrote:
> When ever I use any prototype methods from within internet explorer I
> get an "Object doesn't support this property or method".
>
> Does any body know what's going on?
>
> function SetupListFilters()
> {
>
>
>
>     Sortable.create("filters-list");
>
>     var filters=$$('ul.use-filters li.use-filter a');
>
>     for(i=0; i<filters.length; i++)
>     {
>         Event.observe(filters[i], 'click', function(event)
>         {
>             try
>             {
>                 var e=Event.element(event);
>
>
>                 var filters=$('filters-list');
>
>                 var filter=document.createElement('li');
>                 filter.addClassName('filter');
>                 var a=document.createElement('a');
>                 a.appendChild(document.createTextNode(e.innerHTML));
>                 filter.appendChild(a)
>
>                 filters.appendChild(filter);
>
>                 a.observe('dblclick', RemoveFilter);
>
>                 Sortable.create("filters-list");
>             }
>             catch(e)
>             {
>                 alert(e.message);
>             }
>         });
>     }
>
>
>
>
>
> }
>
>
> >
>   


-- 
MindVision Interactive

Ph: (08) 8212 9544
Fax: (08) 8212 9644

E-Mail: [EMAIL PROTECTED]
Web: www.mindvision.com.au


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to