[Rails-spinoffs] hoverclass doesn't seem to be set from Sortable.create
Hey folks, I'm having a little trouble with the hoverclass parameter of the Sortables.create method. Unfortunately I can't post a demo page at this time, but I'm creating three lists with the following code: Sortable.create("listOne", {dropOnEmpty:true,containment:["listOne","listTwo", "listThree"],constraint:false, hoverclass:"myHover"}); Sortable.create("listTwo", {dropOnEmpty:true,containment:["listOne","listTwo", "listThree"],constraint:false, hoverclass:"myHover"}); Sortable.create("listThree", {dropOnEmpty:true,containment:["listOne","listTwo", "listThree"],constraint:false, hoverclass:"myHover"}); The drag and drop, dropOnEmpty, containment, and constraint all seem to be working correctly for me so far. I assume from the description on this page: http://wiki.script.aculo.us/scriptaculous/show/Sortable.create that the hoverclass is supposed to be a CSS class name that gets applied to the list that I can drop into when I'm hovering over it with a dragged item. However, I'm not seeing the hover class applied in IE6 or Firefox 1.5 with the latest set of files from the svn repository. Here is the myHover in the css: .myHover{ background-color:#66; } Anyone see what I'm doing incorrectly with the code above? Or if there are other factors that can come into play with hover classes such as certain style attributes, or class names not being usable? I don't see any examples of the hovering on the wiki except for the shopping cart which uses droppables not sortables, so if others exist, a link would probably be enough. Thanks all! Danilo Celic ___ Rails-spinoffs mailing list Rails-spinoffs@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
Re: [Rails-spinoffs] Performance issues with Prototype
Gregory Hill wrote: Imagine the situation, when loop body removes one element from the array. It's quite common situation, for example when you operate on select tag and remove options dynamically in loop body, in each loop pass. Thus the length of option collection has changed, and the length must be recalculated. It makes sense, but I was curious how it is possible, given the fact that in Javascript when you access something as an attribute, it doesn't behave as a function. For example, say you were to create your own object with a .length attribute. Could you recalculate that on the fly? No, unless you defined it as a function and then you'd have to call it as a function (this.length() instead of this.length). (Or is it possible by some means I am unaware of?) In may programming languages there is a concept of getters and setters, that are functions that run when a "property" is accessed or set. The length property of an Array object is an example of a getter. Pretty sure that it's not cross browser compatible (not IE, but FF1.5 in my testing), but actually you can define getters and setters that behave within your code as if they are properties, but they are actually functions/methods. Here's a quick page that describes this concept a little: http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Guide:Creating_New_Objects:Defining_Getters_and_Setters and also a little more here: http://ajaxian.com/archives/2005/11/getters_and_set.html Probably more link via google So, changing the behavior for built-ins opens up a large can of worms for programming errors. When you call array.length, you expect it to just retrieve a value. If it were a function, array.length(), you'd expect it to be more intensive and you would be more likely to store the value locally. It's inconsistent, and troublesome, given the fact that there could be myriad other similar examples. Anyway, I guess it just annoys me that this is possible because it means I probably have a lot of optimizing I could do that wouldn't have been an issue if they'd made the built-ins behave the same as user-defined objects. Anytime you access a variable's property multiple times, as in a for loop it takes longer to access it via obj.property then to use var p = obj.property and then use p wherever you needed the value. This presumes that the value of p doesn't change over the course of the operations you're performing, or you need to "recalculate" it every time you change it, or just access the property directly each time and live with the extra time it takes. -- Danilo Celic | Extending Knowledge Daily : http://CommunityMX.com/ | Team Macromedia for Dreamweaver : http://macromedia.com/go/team/ ___ Rails-spinoffs mailing list Rails-spinoffs@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
Re: [Rails-spinoffs] Deconstruct
Thorben Schmitt wrote: hi Folks, I have a little question. I can't found any decostruct Method in the Documentation. eg i use: s1 = Sortable.create("pagetree", ..); now i wanna deconstruct this object. s1 = null doesn't work If you mean stop an element from being sortable, then I think that you can use the destroy menthod of the Sotrables object: http://wiki.script.aculo.us/scriptaculous/show/Sortable.destroy Danilo ___ Rails-spinoffs mailing list Rails-spinoffs@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
Re: [Rails-spinoffs] Re: Status of Prototype
Werner Punz wrote: The most famous example being the struts client side validation which basically was disabled by this, to my knowledge. I know this problem has been fixed. But one of the main critique points by the main critique was, that there are still many of those extensions which could cause potential breakage. For my own education, could you point to a resource that lists, or discusses what these potential breakages could be and what would cause them within a library/framework such as prototype? Danilo ___ Rails-spinoffs mailing list Rails-spinoffs@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
Re: [Rails-spinoffs] Re: Status of Prototype
Werner Punz wrote: Well exactly, and in case of earlier prototype versions the array was broken that way, now if another library used for(var p in anarray) the for iterated wrongly. Thanks for the follow ups Ryan and Werner. Werner, are you saying that folks use a "for in" loop to iterate over the elements within an array? If so, I'm surprised that anyone would think that a for() loop over the elements in an array would be the same thigns as looping over the properties of an object. Or am I misunderstanding the issue? As I said before to me the namespace problem is less problematic (although having namespaces preallocated for ${} Form etc... is not too nice either) but the basic object altering probably is more critical if you try to use prototype in a somewhat unknown environment (where you cannot be sure which lib comes along) I'm not sure which side of the fence I sit at this time, while I can understand that library maintainers should practice denfesive coding techniques to prevent clashes, I can also see that having the flexibility to have base objectys adorned with commonly needed and very useful methods. I think I have a bit of reading and thinking ahead of me. Danilo Celic ___ Rails-spinoffs mailing list Rails-spinoffs@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
Re: [Rails-spinoffs] gmail attached file field magic
Tarek Ziadé wrote: Hello, does someone knows how gmail does file upload when the attached files are automatically saved in drafts ? I am trying to do it in Scriptalicious/Prototype but I don't see how they get the file on the system using js... I don't know how (if) it can be done with Prototype/script.aculo.us but I have seen a blog post about uploading with Dojo, but I'm not sure of the full code needed for that: http://alex.dojotoolkit.org/?p=528 HTH Danilo Celic ___ Rails-spinoffs mailing list Rails-spinoffs@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
Re: [Rails-spinoffs] Scriptaculous + Prototype shrunk to < 50Kb
Jon Tirsen wrote: Most proxy servers don't support gzip-compressed so corporate users still aren't going to benefit from mod_gzip. :-( But wouldn't corporate connections more than likely be on a fatter pipe (especilly those using sophisticated enough to be using proxies) so the weight of the library is much less of a concern for them over "general" web surfers which maybe be more likey to benefit from the compression? I'm assuming that the general web surfers aren't going through proxies themselves, of which I have no knowledge as to the prevelance of proxies so could be assuming incorrectly. Danilo Celic ___ Rails-spinoffs mailing list Rails-spinoffs@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs