[Proto-Scripty] Re: Position.includeScrollOffsets=true and Draggable inside a scrolling div ?

2008-12-18 Thread astilla

Anyone have any ideas on this please?  Still getting the problem -
everything else works perfectly, just the drag offset when the pane
the draggables are in is scrolled down any amount.  Used to work fine
on a Sortable, doesn't seem to work with Draggables

On 16 Dec, 14:01, astilla ajb...@googlemail.com wrote:
 Hi,

 I'm having a problem with using Position.includeScrollOffsets = true
 with a Draggable inside a scrolling layer - the draggable is
 positioned away from the mouse pointer when the layer things are in is
 scrolled down.  I've used the includeScrollOffsets before successfully
 on a Sortable but am not having much luck with a Draggable in the same
 situation - does anyone know if there is anything that needs to be
 done differently?

 Basic, very cut-down outline is:-

 div id=main
 ul
     li class=itemsomething/li

      ... (etc) 

 /ul
 /div

 (script)
     Position.includeScrollOffsets = true;

     $$('li.item').each(function(item) {
         new Draggable(item, {ghosting:true, scroll:'main'});
     });

 (css)
 div#main {
         position: relative;
         float: left;
         width: 75%;
         overflow: scroll;
         height: 100%;
         background-color: white;

 }
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Modal window pop-up

2008-12-18 Thread Alex Mcauley

if you want a prototype based modal window then try this 
http://scripteka.com/script/litbox .. its is very configurable and with a 
little javascript knowledge you can make it ajaxified with requests to fill 
the window with anything you like .

I used it as a base to build my own as i needed flexibility but generally if 
you dont need the felxability i did then it will do you just fine


Regards
Alex


- Original Message - 
From: jrochkind rochk...@jhu.edu
To: Prototype  script.aculo.us prototype-scriptaculous@googlegroups.com
Sent: Wednesday, December 17, 2008 10:33 PM
Subject: [Proto-Scripty] Re: Modal window pop-up



I just spent like two hours googling for this, and found lots of old
and no longer supported stuff, until thinking of specifically
searching within the prototype listserv, and finding this thread. So,
thanks! But it's neccesarily easy to find on Google if you don't know
what you're looking for.

I'm still curious what other developer's opinions are of the various
options on scripteka, hard to tell which ones are still actively
developed etc.

Jonathan

On Nov 26, 9:55 am, Brian Williams brianw1...@gmail.com wrote:
 well, to be fair, he was probably thinking of a prototype solution and not
 necessarily the jQuery solution.

 But, in on the flip side i have the following:

 http://proto-scripty.wikidot.com/extras

 but i do agree, a tiny bit of research would have been more prudent.

 On Wed, Nov 26, 2008 at 9:43 AM, Alex Mcauley 

 webmas...@thecarmarketplace.com wrote:

  They are not tips for prototype they are jQuery tips and are on the 
  jQuery
  page!!

  Regards

  Alex
  - Original Message -
  From: Chris Brody chris.br...@gmail.com
  To: prototype-scriptaculous@googlegroups.com
  Sent: Wednesday, November 26, 2008 12:18 PM
  Subject: [Proto-Scripty] Re: Modal window pop-up

   Quick sugggestion from a beginner to consider putting some of these
   ideas on FAQ  link pages?

   On Wed, Nov 26, 2008 at 1:10 PM, Alex Mcauley
   webmas...@thecarmarketplace.com wrote:
   if you want to use the jquery one you can tell jquery to not conflict
   with
   prototype's namespace

   $jQuery=jQuery.noConflict();

   then ... $jQuery('#some-id').someJqueryFunction() .. for jQuery 
   methods
   and $('some-id').somProtoFunction() .. for prototype methods

   Regards

   Alex

   - Original Message -
   From: Gabriel Gilini
   To: prototype-scriptaculous@googlegroups.com
   Sent: Tuesday, November 25, 2008 5:37 PM
   Subject: [Proto-Scripty] Re: Modal window pop-up
  http://scripteka.com/
   Click in the window tag.

   And please google before posting.

   Gabriel Gilini

  www.usosim.com.br
   gabr...@usosim.com.br
   gabr...@souagil.com.br

   On Tue, Nov 25, 2008 at 2:01 PM, livewire9174 markmch...@gmail.com
   wrote:

   Hi,
   Can anybody recomend me a modal pop-up library to use ? I tried 
   using
   thickbox ( based on jquery) but this wont work as it is conflicting
   with the prototype accordion i am using.

   Has anybody tried something like this?





--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Using Event.observe and checking for childNodes in a parent

2008-12-18 Thread Alex Mcauley

I would look at the observe in a different way ...

by that i mean observe the element that you are hovering not the whole 
window  this way the event will bubble up the DOM and can be stopped as 
bubbling goes up the document not down.. this is a quick and dirty tooltips 
script i wrote a few weeks ago which does the same thing you are trying to 
do

 tooltips : function() {
  $$(tooltipClass+' div').invoke('observe', 'mouseover', function(event) 
{event.stop();});
  $$(tooltipClass+' img').invoke('observe', 'mouseover', function(event) 
{event.stop();});
$$(tooltipClass).invoke('observe', 'mouseover', function(event) {
if($$(invokedTooltipClass).length = 1) {
 return;
}

var text=$(this).down(0).innerHTML;
if(text=='') {
 return;
}
   var width=(text.length*10)+'px';

   var x=Event.pointerX(event)-30;// horizontal (Left to Right)
   var y=Event.pointerY(event)+20; // vertical (Top to Bototm)

   var el = new Element('div', { 'class': 'tt','style' : 
'display:none;position:absolute;top:'+y+'px;left:'+x+'px;z-index:;max-width:300px;'
 
 }).update('div style=float:right;width:22px;margin-left:6px;img 
src=/resources/includes/images/help.png //div'+text);
   $(this).insert(el);
   Effect.Appear(el);
var att=this;
   Event.stop(event);

   $$(tooltipClass).invoke('observe', 'mouseout', function(event) {
$$('.tt').each(function(elem) {
  Effect.Fade(elem);
  $(elem).remove();
});
   });
 });
}


basically what it does is has an element with a classname in this case 
.tooltip ... inside the element is has a hidden span containing html

div class=tooltipspan style=display:none;The HTML i want to 
display/spanThis is my tooltip Element ... Hover me to see the tip/div


The first couple of lines stop the event bubbliing to the html i put into it 
(just an image and a div in this case) .. you can see how its not bubbled up 
the DOM and its all pretty self explanitory .. you can see the mouse out 
function too (that removes the created tip when its lost its hover) ..


hope this helps a bit into understanding how things like this can be 
achieved


Regards
Alex








- Original Message - 
From: Calvin L cal...@gmail.com
To: Prototype  script.aculo.us prototype-scriptaculous@googlegroups.com
Sent: Wednesday, December 17, 2008 2:42 AM
Subject: [Proto-Scripty] Using Event.observe and checking for childNodes in 
a parent



 Hi everyone,

 I've been baffled on day on how to get this done. I'm fairly new to
 Javascript and Prototype, so excuse me if I sound stupid!

 I have an element, that, when hovered over, displays an absolutely
 positioned div. This div has a bunch of other elements inside it,
 because it displays a lot of information. I'm trying to use
 Event.observe to tell prototype when to close the popup div. I only
 want it to show when hovered over, and disappear when the mouse moves
 outside of the popup. Here's my code:

 Event.observe(window, 'mouseover', function(event){
 var elem = Event.element(event);
 if(elem.id != prodElem){
 $(prodElem).hide();
 event.stop();
 }
 });

 where prodElem is the id of popup div. The problem is, when I hover
 over the other elements inside prodElem, it will hide the popup. There
 are a zillion elements in there and I don't want to have to list out
 all the elements. Is there some way to check for all childNodes within
 a parent node?

 Thanks for any help!

 Calvin

 
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Improving FPS Speeds

2008-12-18 Thread Craig

Thanks for your reply. I'm self taught javascript im afraid so unaware
of the best way to do things and I coded the sliders a while ago. Will
take on board what you said and also do some research into best
practices. If you have any recommendations on what to read would be
much appreciated

Thanks

On Dec 18, 3:26 am, RobG rg...@iinet.net.au wrote:
 On Dec 17, 8:52 pm, Craig cr...@europe.com wrote:

  site im developing is not live but similar tohttp://www.aspecto.co.uk/

  Is there much use in creating a slider function to run all the sliders
  from would this make much of a difference?

 It might make the code tidier and get rid of some global variables,
 but I doubt that it will have any effect on speed.

 There seems to be an over reliance on try..catch, which should be used
 about as often as eval (i.e. rarely and usually when there is no other
 option).  It seems to be used whenever the code author was too lazy to
 test if an object exists before trying to do something with it, e.g.

     try
     {
         width_r = ($('side_right').scrollHeight - $
 ('side_right').offsetHeight);
     }
     catch(error)
     {
         width_r = 100
     }

 Presumably that was done because an element with id side_right may not
 exist. Consider:

   var el = $('side_right');

   // If that didn't return something, deal with it
   if (!el) return;

   // Otherwise, use el
   width_r = el.scrollHeight - el.offsetHeight;

 Then there is:

     if(width_r  1)
     {
         width_r = 1
     }

 If width_r must have a value within a specified range (in this case it
 seems to be that it must be 0), it should be dealt with when it is
 set and the reason should be documented:

   // width_r must have a positive integer value
   width_r = (el.scrollHeight - el.offsetHeight) || 1;

 and so on.  If you want analysis of your slow code, you'll need to
 post, or link to, an example that is slow.

 --
 Rob
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Extending Event has a Bug ?

2008-12-18 Thread fero

On Dec 17, 11:52 pm, kangax kan...@gmail.com wrote:
 On Dec 17, 1:51 pm, fero elf...@gmail.com wrote:
 [...]

  I think it is quite a bug because I have to check for
  Prototype.Browser.IE variable.

 I'm pretty sure there's *no* bug in nonexistent `Event.addMethods` ; )

Yes, you are truly right ... it was just a joke :)


 Extending event objects is like playing with fire.

This is meaningful :)

Ok thank you for your answer

BTW with function.methodize I didn't succeded too.

fero
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Problem (propably logical one) with dynamic fadein / fadeout for a navigation menu

2008-12-18 Thread Chris

Hi,

thanks for your hints, I managed to get it right that way. The code is
a bit different from yours, because I dont want multiple effects to
overlap. I also added a short timeout, so the effects have enough time
to finish. If someone is running into similiar problems, here is the
full code example that I use:

/**
 * Create special effects for special
 * navigation mouseovers.
 */
function createSpecialEffects(){

// Cache needed elements
elms = $$('div#products_new ul li a img');
runSuccess = false;

elms.each(function(slink){

slink.observe('mouseover', function(e) {

runSuccess = false;

if(typeof(this.srcelm) == 'undefined') this.srcelm = 
Event.element
(e)
fadeArray = elms.without(this.srcelm);

fadeArray.each(function(ef) {
if(ef.getStyle('opacity') != 0.3)
ef.fade({
duration: 0.5,
to: 0.3,
scope: 'specials',
limit: 1
});
});

if (this.srcelm.getStyle('opacity') != 1.0) {
this.srcelm.appear({
duration: 0.5,
to: 1.0,
scope: 'specials',
limit: 1,
beforeStart: function() { runSuccess = 
true; },
afterFinish: function() { runSuccess = 
true; }
});
}
if(typeof(timer) != 'undefined') 
window.clearTimeout(timer)
});

slink.observe('mouseout', function(e) {

if (runSuccess) {

timer = setTimeout(function() {
fadeArray.each(function(ef) {
if(ef.getStyle('opacity') != 
0.3) return;
ef.appear({
duration: 0.5,
to: 1.0,
scope: 'specials',
limit: 1
});
});
}, 500)
}
});
});
}
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Sorting on a JSON array

2008-12-18 Thread George

Just wondering if anyone had any ideas about how to sort JSON data.
I'm sure there must be an easy way.

Many thanks

George

On Dec 16, 12:43 pm, George george.bea...@googlemail.com wrote:
 Hi Folks,
 I wondered if there was a way to sort a JSON array.  Here's an
 example:

 var RS =  [
 {id: 1, dateFrom: 20090101, dateTo: 20090309, tariff: [
   {guest: 1, mon: 105, tue: 79, wed: 79, thu: 79, fri: 99, sat: 109,
 sun: 79},
   {guest: 2, mon: 89, tue: 89, wed: 89, thu: 89, fri: 109, sat: 119,
 sun: 89}
 ]},
 {id: 2, dateFrom: 20090302, dateTo: 20090304, tariffhigh: 180,
 tarifflow: 150, tariff: [
   {guest: 1, mon: 240, tue: 0, wed: 0, thu: 0, fri: 0, sat: 0, sun:
 0},
   {guest: 2, mon: 220, tue: 0, wed: 0, thu: 0, fri: 0, sat: 0, sun: 0}
 ]},
 {id: 0, dateFrom: 20081216, dateTo: 20081216, tariff: [
   {guest: 1, mon: 0, tue: 0, wed: 0, thu: 0, fri: 0, sat: 0, sun: 0}
 ]}
 ]

 RS.sortBy(function(i){return i.dateFrom},this)

 I've simplified this code slightly but you should get the general
 idea.

 I'm trying to reorder by dateFrom but I can't get sortBy to sort in
 this case.  Anyone know what I'm doing wrong, or is there an
 altogether better way?

 Many thanks

 George
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Nested JSON problem

2008-12-18 Thread George

Hi Jason,

Forgive me if I've misunderstood the question, but hopefully this
might help.

As far as I know, you can infinitely nest your JSON data if that's
what you want to do.  I've noticed some fundamental problems with your
JSON you pasted in your post which may just be typos, but need to be
cleared up before your code will work.  Firstly the items in your
'flowerset' are not enclosed in square brackets.  Secondly your names
(eg groupCode) do not need to be enclosed in quotations although this
won't break things.  Thirdly, in my opinion, you could break this down
and request a much smaller and less complex dataset from the server
(maybe just the group names first, then depending on what the user
clicked on get the flower names and so on)  Thus putting less load on
the server and reducing bandwidth.  Also, I'd say to have everything
nested under the name rsJson just adds another unnecessary dimension
of complication.

Think of JSON as just a long bunch of name value pairs [{name:value}]
separated by commas where a value can be a number, string or another
array.  If your value is another array, then it must be enclosed in
square brackets.  As such, there should never be a curly bracket
immediately after a colon ( [{name:{name:value, name:value},
name:value}] ) is wrong.  [{name:[{name:value, name:value}],
name:value}] is correct.

I've cleaned up a little bit of your data just to demonstrate the
correct syntax:

{rsJson:
  [
{groupCode:1,groupName:Roses,flowerSet:[
  {flowers: [
{flowerCode:15,flowerName:Roses}
]}
  ]},
{groupCode:2,groupName:Carnations,flowerSet:[
  {flowers:[
{flowerCode:16,flowerName:Spray Carnations},
{flowerCode:17,flowerName:Standard Carnations}
]}
  ]}
  ]}

To get to your data do something like this:

myDataSetVar[0].rsJson[0].groupCode   (would give you 1)
myDataSetVar[0].rsJson[1].flowerSet[0].flowers[1].flowerName  (would
give you Standard Carnations)


Really hope that helps and I haven't confused things further.

All the best

George


On Dec 18, 9:04 am, jason maina jason.ma...@gmail.com wrote:
 Thanks Ryan guess was kind of tired had failed looking at some of the points
 rather was not getting the point. Finally I'm through this is the final
 product:

 {rsJson:[{groupCode:1,groupName:Roses,flowerSet:{flowers:[{flowerCode:15,flowerName:Roses}]}},{groupCode:2,groupName:Carnations,flowerSet:{flowers:[{flowerCode:16,flowerName:Spray
 Carnations},{flowerCode:17,flowerName:Standard
 Carnations}]}},{groupCode:3,groupName:Perennials,flowerSet:{flowers:[{flowerCode:2,flowerName:Aster},{flowerCode:3,flowerName:Alstromeria},{flowerCode:10,flowerName:Gysophila},{flowerCode:12,flowerName:Limonium
 Perezzi}]}},{groupCode:4,groupName:Annuals,flowerSet:{flowers:[{flowerCode:1,flowerName:Ammi
 Majus},{flowerCode:4,flowerName:Bupleurum},{flowerCode:5,flowerName:Carthamus},{flowerCode:6,flowerName:Chinese
 Aster},{flowerCode:7,flowerName:Chrysantemum},{flowerCode:8,flowerName:Delphinium},{flowerCode:13,flowerName:Lisianthus},{flowerCode:14,flowerName:Molucella},{flowerCode:18,flowerName:Statice},{flowerCode:19,flowerName:Stocks}]}},{groupCode:5,groupName:Bulbs,flowerSet:{flowers:[{flowerCode:9,flowerName:Freesia},{flowerCode:11,flowerName:Lilies}]}}]}

 kind regards
 Jason

 On Wed, Dec 17, 2008 at 8:04 PM, jason maina jason.ma...@gmail.com wrote:
  What im wondering out of the reply is I cant have a nested JSON object with
  the following layout?

  groupID, groupName, groupItems(array of items)

  similar example:

 http://labs.adobe.com/technologies/spry/samples/data_region/JSONDataS...

  Regards,
  Jason

  On Wed, Dec 17, 2008 at 7:02 PM, Ryan Gahl ryan.g...@gmail.com wrote:

  typo... ...with NO properties

  On Wed, Dec 17, 2008 at 10:02 AM, Ryan Gahl ryan.g...@gmail.com wrote:

  Here are your problems... I'll remove the bulk of the data to make it
  more clear:

  rsJson: {[{...}]}

  what you have is illegal. You're essentially saying you have an anonymous
  object with not properties and filling it with an array (that's probably 
  not
  even totally accurate)... the bottom line is, you can't have a curly brace
  immediately followed by a square brace. And going further you have it all
  just sitting in a property floating in space. The first thing you need to 
  do
  is wrap the property in curlies so you're actually returning an object...

  {rsJson: ...}

  Now, this other issue of putting a square bracket right inside a curly...
  You can either a) remove the outer curlies and just make rsJson be an 
  array,
  or b) add a property name which then becomes the array.

  a)
  {rsJson: [{}, {}, ...]}

  b)
  {rsJson: {myArray: [...]}}

  On Wed, Dec 17, 2008 at 9:53 AM, jason maina jason.ma...@gmail.comwrote:

  Hi all,
  Below is JSON encoded(php) data. After evaluating and sanitizing it im
  not capable of extracting its contents im just not sure what im doing 
  wrong:

  [php output]

  

[Proto-Scripty] Re: Nested JSON problem

2008-12-18 Thread jason maina
Hi George,

Thanks for the input.
Well, the data is converted to json by php from a nested array after
extracting the data from a database thus the reason why there's  flowerset
and flowers.

Im finally through with it, it looks kinda complicated in the nesting
element but it somehow while retreiving the data it was easy remebering the
various layers.

On the same breath will be looking into streamlining it and making it thin
as you have outlined.

Thanks
Regards
Jason

On Thu, Dec 18, 2008 at 4:42 PM, George george.bea...@googlemail.comwrote:


 Hi Jason,

 Forgive me if I've misunderstood the question, but hopefully this
 might help.

 As far as I know, you can infinitely nest your JSON data if that's
 what you want to do.  I've noticed some fundamental problems with your
 JSON you pasted in your post which may just be typos, but need to be
 cleared up before your code will work.  Firstly the items in your
 'flowerset' are not enclosed in square brackets.  Secondly your names
 (eg groupCode) do not need to be enclosed in quotations although this
 won't break things.  Thirdly, in my opinion, you could break this down
 and request a much smaller and less complex dataset from the server
 (maybe just the group names first, then depending on what the user
 clicked on get the flower names and so on)  Thus putting less load on
 the server and reducing bandwidth.  Also, I'd say to have everything
 nested under the name rsJson just adds another unnecessary dimension
 of complication.

 Think of JSON as just a long bunch of name value pairs [{name:value}]
 separated by commas where a value can be a number, string or another
 array.  If your value is another array, then it must be enclosed in
 square brackets.  As such, there should never be a curly bracket
 immediately after a colon ( [{name:{name:value, name:value},
 name:value}] ) is wrong.  [{name:[{name:value, name:value}],
 name:value}] is correct.

 I've cleaned up a little bit of your data just to demonstrate the
 correct syntax:

 {rsJson:
   [
{groupCode:1,groupName:Roses,flowerSet:[
  {flowers: [
{flowerCode:15,flowerName:Roses}
]}
  ]},
{groupCode:2,groupName:Carnations,flowerSet:[
  {flowers:[
{flowerCode:16,flowerName:Spray Carnations},
{flowerCode:17,flowerName:Standard Carnations}
]}
   ]}
  ]}

 To get to your data do something like this:

 myDataSetVar[0].rsJson[0].groupCode   (would give you 1)
 myDataSetVar[0].rsJson[1].flowerSet[0].flowers[1].flowerName  (would
 give you Standard Carnations)


 Really hope that helps and I haven't confused things further.

 All the best

 George


 On Dec 18, 9:04 am, jason maina jason.ma...@gmail.com wrote:
  Thanks Ryan guess was kind of tired had failed looking at some of the
 points
  rather was not getting the point. Finally I'm through this is the final
  product:
 
 
 {rsJson:[{groupCode:1,groupName:Roses,flowerSet:{flowers:[{flowerCode:15,flowerName:Roses}]}},{groupCode:2,groupName:Carnations,flowerSet:{flowers:[{flowerCode:16,flowerName:Spray
  Carnations},{flowerCode:17,flowerName:Standard
 
 Carnations}]}},{groupCode:3,groupName:Perennials,flowerSet:{flowers:[{flowerCode:2,flowerName:Aster},{flowerCode:3,flowerName:Alstromeria},{flowerCode:10,flowerName:Gysophila},{flowerCode:12,flowerName:Limonium
 
 Perezzi}]}},{groupCode:4,groupName:Annuals,flowerSet:{flowers:[{flowerCode:1,flowerName:Ammi
 
 Majus},{flowerCode:4,flowerName:Bupleurum},{flowerCode:5,flowerName:Carthamus},{flowerCode:6,flowerName:Chinese
 
 Aster},{flowerCode:7,flowerName:Chrysantemum},{flowerCode:8,flowerName:Delphinium},{flowerCode:13,flowerName:Lisianthus},{flowerCode:14,flowerName:Molucella},{flowerCode:18,flowerName:Statice},{flowerCode:19,flowerName:Stocks}]}},{groupCode:5,groupName:Bulbs,flowerSet:{flowers:[{flowerCode:9,flowerName:Freesia},{flowerCode:11,flowerName:Lilies}]}}]}
 
  kind regards
  Jason
 
  On Wed, Dec 17, 2008 at 8:04 PM, jason maina jason.ma...@gmail.com
 wrote:
   What im wondering out of the reply is I cant have a nested JSON object
 with
   the following layout?
 
   groupID, groupName, groupItems(array of items)
 
   similar example:
 
  http://labs.adobe.com/technologies/spry/samples/data_region/JSONDataS.
 ..
 
   Regards,
   Jason
 
   On Wed, Dec 17, 2008 at 7:02 PM, Ryan Gahl ryan.g...@gmail.com
 wrote:
 
   typo... ...with NO properties
 
   On Wed, Dec 17, 2008 at 10:02 AM, Ryan Gahl ryan.g...@gmail.com
 wrote:
 
   Here are your problems... I'll remove the bulk of the data to make it
   more clear:
 
   rsJson: {[{...}]}
 
   what you have is illegal. You're essentially saying you have an
 anonymous
   object with not properties and filling it with an array (that's
 probably not
   even totally accurate)... the bottom line is, you can't have a curly
 brace
   immediately followed by a square brace. And going further you have it
 all
   just sitting in a property floating in space. The first thing you
 need to do
   is wrap the 

[Proto-Scripty] Re: Namespacing/Loading module

2008-12-18 Thread Chris Wash

I found Package on www.scripteka.com

See http://code.google.com/p/kproto/

On Dec 17, 11:40 am, Chris Wash chris.w...@gmail.com wrote:
 Has anyone implemented a namespacing and importing module the likes of
 YUI's Namespace/Loader or Dojo's declare/provide/require?

 Please don't tell me one already exists and I have overlooked it.

 I think this should be a very high priority for Prototype/
 Scriptaculous.  You just can't maintain a codebase of any size or hope
 to reuse things properly without it.

 Any thoughts?

 Thanks,

 Chris
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Sorting on a JSON array

2008-12-18 Thread Chris Wash

You're not seeing this work?  Looks like it works as you expect, at
least when looking at it with Firebug:

testSortBy : function () {
var RS =  [
{id: 1, dateFrom: 20090101, dateTo: 
20090309, tariff: [
{guest: 1, mon: 105, tue: 79, 
wed: 79, thu: 79, fri: 99, sat:
109, sun: 79},
{guest: 2, mon: 89, tue: 89, 
wed: 89, thu: 89, fri: 109, sat:
119, sun: 89}
]},
{id: 2, dateFrom: 20090302, dateTo: 
20090304, tariffhigh: 180,
tarifflow: 150, tariff: [
  {guest: 1, mon: 240, tue: 0, wed: 0, 
thu: 0, fri: 0, sat: 0,
sun: 0},
  {guest: 2, mon: 220, tue: 0, wed: 0, 
thu: 0, fri: 0, sat: 0,
sun: 0}
]},
{id: 0, dateFrom: 20081216, dateTo: 
20081216, tariff: [
  {guest: 1, mon: 0, tue: 0, wed: 0, 
thu: 0, fri: 0, sat: 0, sun:
0}
]}
];

console.log(RS);
console.log(RS.sortBy(function(i){return i.dateFrom},this))
}


The first console.log call shows me this:
0   Object id=1 dateFrom=20090101 dateTo=20090309 tariff=Object
1   Object id=2 dateFrom=20090302 dateTo=20090304
2   Object id=0 dateFrom=20081216 dateTo=20081216 tariff=Object


The second shows me this:
0   Object id=0 dateFrom=20081216 dateTo=20081216 tariff=Object
1   Object id=1 dateFrom=20090101 dateTo=20090309 tariff=Object
2   Object id=2 dateFrom=20090302 dateTo=20090304

Is that not what you're expecting to see?


On Dec 18, 8:08 am, George george.bea...@googlemail.com wrote:
 Just wondering if anyone had any ideas about how to sort JSON data.
 I'm sure there must be an easy way.

 Many thanks

 George

 On Dec 16, 12:43 pm, George george.bea...@googlemail.com wrote:

  Hi Folks,
  I wondered if there was a way to sort a JSON array.  Here's an
  example:

  var RS =  [
  {id: 1, dateFrom: 20090101, dateTo: 20090309, tariff: [
    {guest: 1, mon: 105, tue: 79, wed: 79, thu: 79, fri: 99, sat: 109,
  sun: 79},
    {guest: 2, mon: 89, tue: 89, wed: 89, thu: 89, fri: 109, sat: 119,
  sun: 89}
  ]},
  {id: 2, dateFrom: 20090302, dateTo: 20090304, tariffhigh: 180,
  tarifflow: 150, tariff: [
    {guest: 1, mon: 240, tue: 0, wed: 0, thu: 0, fri: 0, sat: 0, sun:
  0},
    {guest: 2, mon: 220, tue: 0, wed: 0, thu: 0, fri: 0, sat: 0, sun: 0}
  ]},
  {id: 0, dateFrom: 20081216, dateTo: 20081216, tariff: [
    {guest: 1, mon: 0, tue: 0, wed: 0, thu: 0, fri: 0, sat: 0, sun: 0}
  ]}
  ]

  RS.sortBy(function(i){return i.dateFrom},this)

  I've simplified this code slightly but you should get the general
  idea.

  I'm trying to reorder by dateFrom but I can't get sortBy to sort in
  this case.  Anyone know what I'm doing wrong, or is there an
  altogether better way?

  Many thanks

  George
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Nested JSON problem

2008-12-18 Thread Richard Quadling

2008/12/18 jason maina jason.ma...@gmail.com:
 Hi George,

 Thanks for the input.
 Well, the data is converted to json by php from a nested array after
 extracting the data from a database thus the reason why there's  flowerset
 and flowers.

 Im finally through with it, it looks kinda complicated in the nesting
 element but it somehow while retreiving the data it was easy remebering the
 various layers.

 On the same breath will be looking into streamlining it and making it thin
 as you have outlined.

 Thanks
 Regards
 Jason

 On Thu, Dec 18, 2008 at 4:42 PM, George george.bea...@googlemail.com
 wrote:

 Hi Jason,

 Forgive me if I've misunderstood the question, but hopefully this
 might help.

 As far as I know, you can infinitely nest your JSON data if that's
 what you want to do.  I've noticed some fundamental problems with your
 JSON you pasted in your post which may just be typos, but need to be
 cleared up before your code will work.  Firstly the items in your
 'flowerset' are not enclosed in square brackets.  Secondly your names
 (eg groupCode) do not need to be enclosed in quotations although this
 won't break things.  Thirdly, in my opinion, you could break this down
 and request a much smaller and less complex dataset from the server
 (maybe just the group names first, then depending on what the user
 clicked on get the flower names and so on)  Thus putting less load on
 the server and reducing bandwidth.  Also, I'd say to have everything
 nested under the name rsJson just adds another unnecessary dimension
 of complication.

 Think of JSON as just a long bunch of name value pairs [{name:value}]
 separated by commas where a value can be a number, string or another
 array.  If your value is another array, then it must be enclosed in
 square brackets.  As such, there should never be a curly bracket
 immediately after a colon ( [{name:{name:value, name:value},
 name:value}] ) is wrong.  [{name:[{name:value, name:value}],
 name:value}] is correct.

 I've cleaned up a little bit of your data just to demonstrate the
 correct syntax:

 {rsJson:
  [
{groupCode:1,groupName:Roses,flowerSet:[
  {flowers: [
{flowerCode:15,flowerName:Roses}
]}
  ]},
{groupCode:2,groupName:Carnations,flowerSet:[
  {flowers:[
{flowerCode:16,flowerName:Spray Carnations},
{flowerCode:17,flowerName:Standard Carnations}
]}
  ]}
  ]}

 To get to your data do something like this:

 myDataSetVar[0].rsJson[0].groupCode   (would give you 1)
 myDataSetVar[0].rsJson[1].flowerSet[0].flowers[1].flowerName  (would
 give you Standard Carnations)


 Really hope that helps and I haven't confused things further.

 All the best

 George


 On Dec 18, 9:04 am, jason maina jason.ma...@gmail.com wrote:
  Thanks Ryan guess was kind of tired had failed looking at some of the
  points
  rather was not getting the point. Finally I'm through this is the final
  product:
 
 
  {rsJson:[{groupCode:1,groupName:Roses,flowerSet:{flowers:[{flowerCode:15,flowerName:Roses}]}},{groupCode:2,groupName:Carnations,flowerSet:{flowers:[{flowerCode:16,flowerName:Spray
  Carnations},{flowerCode:17,flowerName:Standard
 
  Carnations}]}},{groupCode:3,groupName:Perennials,flowerSet:{flowers:[{flowerCode:2,flowerName:Aster},{flowerCode:3,flowerName:Alstromeria},{flowerCode:10,flowerName:Gysophila},{flowerCode:12,flowerName:Limonium
 
  Perezzi}]}},{groupCode:4,groupName:Annuals,flowerSet:{flowers:[{flowerCode:1,flowerName:Ammi
 
  Majus},{flowerCode:4,flowerName:Bupleurum},{flowerCode:5,flowerName:Carthamus},{flowerCode:6,flowerName:Chinese
 
  Aster},{flowerCode:7,flowerName:Chrysantemum},{flowerCode:8,flowerName:Delphinium},{flowerCode:13,flowerName:Lisianthus},{flowerCode:14,flowerName:Molucella},{flowerCode:18,flowerName:Statice},{flowerCode:19,flowerName:Stocks}]}},{groupCode:5,groupName:Bulbs,flowerSet:{flowers:[{flowerCode:9,flowerName:Freesia},{flowerCode:11,flowerName:Lilies}]}}]}
 
  kind regards
  Jason
 
  On Wed, Dec 17, 2008 at 8:04 PM, jason maina jason.ma...@gmail.com
  wrote:
   What im wondering out of the reply is I cant have a nested JSON object
   with
   the following layout?
 
   groupID, groupName, groupItems(array of items)
 
   similar example:
 
 
   http://labs.adobe.com/technologies/spry/samples/data_region/JSONDataS...
 
   Regards,
   Jason
 
   On Wed, Dec 17, 2008 at 7:02 PM, Ryan Gahl ryan.g...@gmail.com
   wrote:
 
   typo... ...with NO properties
 
   On Wed, Dec 17, 2008 at 10:02 AM, Ryan Gahl ryan.g...@gmail.com
   wrote:
 
   Here are your problems... I'll remove the bulk of the data to make
   it
   more clear:
 
   rsJson: {[{...}]}
 
   what you have is illegal. You're essentially saying you have an
   anonymous
   object with not properties and filling it with an array (that's
   probably not
   even totally accurate)... the bottom line is, you can't have a curly
   brace
   immediately followed by a square brace. And going further you have
   it all
   just sitting 

[Proto-Scripty] Re: Adding properties to all form elements

2008-12-18 Thread Diodeus

I don't believe html properties elements are extensible. All you can
do is add css class names.

On Dec 17, 12:29 pm, Kupido kup...@hotmail.com wrote:
 I need to extend all form elements with some properties. To add my own
 methods, I use:

 Object.extend(Form.Methods, {
     method1: function ()
     {
     },
     method2: function ()
     {
     },
     ...

 });

 Element.addMethods();

 I don't know if this is the right way but it works.

 So, how can I add my own properties too? Is there a way to have an
 initialization function automatically called on every form element? I
 tried extending Form.Methods with the initialize() function but it
 seemed not to work for forms created with document.createElement
 ('form').

 Any suggestion?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Nested JSON problem

2008-12-18 Thread George

You learn something every day!  Many thanks for that Richard.

On Dec 18, 4:16 pm, Richard Quadling rquadl...@googlemail.com
wrote:
 2008/12/18 jason maina jason.ma...@gmail.com:



  Hi George,

  Thanks for the input.
  Well, the data is converted to json by php from a nested array after
  extracting the data from a database thus the reason why there's  flowerset
  and flowers.

  Im finally through with it, it looks kinda complicated in the nesting
  element but it somehow while retreiving the data it was easy remebering the
  various layers.

  On the same breath will be looking into streamlining it and making it thin
  as you have outlined.

  Thanks
  Regards
  Jason

  On Thu, Dec 18, 2008 at 4:42 PM, George george.bea...@googlemail.com
  wrote:

  Hi Jason,

  Forgive me if I've misunderstood the question, but hopefully this
  might help.

  As far as I know, you can infinitely nest your JSON data if that's
  what you want to do.  I've noticed some fundamental problems with your
  JSON you pasted in your post which may just be typos, but need to be
  cleared up before your code will work.  Firstly the items in your
  'flowerset' are not enclosed in square brackets.  Secondly your names
  (eg groupCode) do not need to be enclosed in quotations although this
  won't break things.  Thirdly, in my opinion, you could break this down
  and request a much smaller and less complex dataset from the server
  (maybe just the group names first, then depending on what the user
  clicked on get the flower names and so on)  Thus putting less load on
  the server and reducing bandwidth.  Also, I'd say to have everything
  nested under the name rsJson just adds another unnecessary dimension
  of complication.

  Think of JSON as just a long bunch of name value pairs [{name:value}]
  separated by commas where a value can be a number, string or another
  array.  If your value is another array, then it must be enclosed in
  square brackets.  As such, there should never be a curly bracket
  immediately after a colon ( [{name:{name:value, name:value},
  name:value}] ) is wrong.  [{name:[{name:value, name:value}],
  name:value}] is correct.

  I've cleaned up a little bit of your data just to demonstrate the
  correct syntax:

  {rsJson:
   [
     {groupCode:1,groupName:Roses,flowerSet:[
       {flowers: [
         {flowerCode:15,flowerName:Roses}
         ]}
       ]},
     {groupCode:2,groupName:Carnations,flowerSet:[
       {flowers:[
         {flowerCode:16,flowerName:Spray Carnations},
         {flowerCode:17,flowerName:Standard Carnations}
         ]}
       ]}
   ]}

  To get to your data do something like this:

  myDataSetVar[0].rsJson[0].groupCode   (would give you 1)
  myDataSetVar[0].rsJson[1].flowerSet[0].flowers[1].flowerName  (would
  give you Standard Carnations)

  Really hope that helps and I haven't confused things further.

  All the best

  George

  On Dec 18, 9:04 am, jason maina jason.ma...@gmail.com wrote:
   Thanks Ryan guess was kind of tired had failed looking at some of the
   points
   rather was not getting the point. Finally I'm through this is the final
   product:

   {rsJson:[{groupCode:1,groupName:Roses,flowerSet:{flowers:[{flowerCode:15,flowerName:Roses}]}},{groupCode:2,groupName:Carnations,flowerSet:{flowers:[{flowerCode:16,flowerName:Spray
   Carnations},{flowerCode:17,flowerName:Standard

   Carnations}]}},{groupCode:3,groupName:Perennials,flowerSet:{flowers:[{flowerCode:2,flowerName:Aster},{flowerCode:3,flowerName:Alstromeria},{flowerCode:10,flowerName:Gysophila},{flowerCode:12,flowerName:Limonium

   Perezzi}]}},{groupCode:4,groupName:Annuals,flowerSet:{flowers:[{flowerCode:1,flowerName:Ammi

   Majus},{flowerCode:4,flowerName:Bupleurum},{flowerCode:5,flowerName:Carthamus},{flowerCode:6,flowerName:Chinese

   Aster},{flowerCode:7,flowerName:Chrysantemum},{flowerCode:8,flowerName:Delphinium},{flowerCode:13,flowerName:Lisianthus},{flowerCode:14,flowerName:Molucella},{flowerCode:18,flowerName:Statice},{flowerCode:19,flowerName:Stocks}]}},{groupCode:5,groupName:Bulbs,flowerSet:{flowers:[{flowerCode:9,flowerName:Freesia},{flowerCode:11,flowerName:Lilies}]}}]}

   kind regards
   Jason

   On Wed, Dec 17, 2008 at 8:04 PM, jason maina jason.ma...@gmail.com
   wrote:
What im wondering out of the reply is I cant have a nested JSON object
with
the following layout?

groupID, groupName, groupItems(array of items)

similar example:

http://labs.adobe.com/technologies/spry/samples/data_region/JSONDataS...

Regards,
Jason

On Wed, Dec 17, 2008 at 7:02 PM, Ryan Gahl ryan.g...@gmail.com
wrote:

typo... ...with NO properties

On Wed, Dec 17, 2008 at 10:02 AM, Ryan Gahl ryan.g...@gmail.com
wrote:

Here are your problems... I'll remove the bulk of the data to make
it
more clear:

rsJson: {[{...}]}

what you have is illegal. You're essentially saying you have an
anonymous
object with not properties and filling it with 

[Proto-Scripty] Re: Adding properties to all form elements

2008-12-18 Thread kangax

On Dec 18, 11:16 am, Diodeus diod...@gmail.com wrote:
 I don't believe html properties elements are extensible. All you can
 do is add css class names.

Actually they are. At least in Mozilla:

HTMLFormElement.prototype.foo = 5;
document.createElement('form').foo; // 5

[...]

--
kangax
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Adding properties to all form elements

2008-12-18 Thread Kupido

Unfortunately I need my application to be compatible with IE too... :(

What about the initialization function?

Object.extend(Form.Methods, {
initialize: function (form)
{
form = $(form);

form.property1 = 'test';
form.property2 = ['t', 'e', 's', 't'];

// and so on
}
});

This is working for stardard forms but not for dinamically created
forms (document.createElement). Why?
Is there a better way of doing this?

On 18 Dic, 17:44, kangax kan...@gmail.com wrote:
 On Dec 18, 11:16 am, Diodeus diod...@gmail.com wrote:

  I don't believe html properties elements are extensible. All you can
  do is add css class names.

 Actually they are. At least in Mozilla:

 HTMLFormElement.prototype.foo = 5;
 document.createElement('form').foo; // 5

 [...]

 --
 kangax
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Nested JSON problem

2008-12-18 Thread jason maina

Is it to mean that it cant support a large 'recordset' ?

On 12/18/08, Richard Quadling rquadl...@googlemail.com wrote:

 2008/12/18 jason maina jason.ma...@gmail.com:
 Hi George,

 Thanks for the input.
 Well, the data is converted to json by php from a nested array after
 extracting the data from a database thus the reason why there's  flowerset
 and flowers.

 Im finally through with it, it looks kinda complicated in the nesting
 element but it somehow while retreiving the data it was easy remebering
 the
 various layers.

 On the same breath will be looking into streamlining it and making it thin
 as you have outlined.

 Thanks
 Regards
 Jason

 On Thu, Dec 18, 2008 at 4:42 PM, George george.bea...@googlemail.com
 wrote:

 Hi Jason,

 Forgive me if I've misunderstood the question, but hopefully this
 might help.

 As far as I know, you can infinitely nest your JSON data if that's
 what you want to do.  I've noticed some fundamental problems with your
 JSON you pasted in your post which may just be typos, but need to be
 cleared up before your code will work.  Firstly the items in your
 'flowerset' are not enclosed in square brackets.  Secondly your names
 (eg groupCode) do not need to be enclosed in quotations although this
 won't break things.  Thirdly, in my opinion, you could break this down
 and request a much smaller and less complex dataset from the server
 (maybe just the group names first, then depending on what the user
 clicked on get the flower names and so on)  Thus putting less load on
 the server and reducing bandwidth.  Also, I'd say to have everything
 nested under the name rsJson just adds another unnecessary dimension
 of complication.

 Think of JSON as just a long bunch of name value pairs [{name:value}]
 separated by commas where a value can be a number, string or another
 array.  If your value is another array, then it must be enclosed in
 square brackets.  As such, there should never be a curly bracket
 immediately after a colon ( [{name:{name:value, name:value},
 name:value}] ) is wrong.  [{name:[{name:value, name:value}],
 name:value}] is correct.

 I've cleaned up a little bit of your data just to demonstrate the
 correct syntax:

 {rsJson:
  [
{groupCode:1,groupName:Roses,flowerSet:[
  {flowers: [
{flowerCode:15,flowerName:Roses}
]}
  ]},
{groupCode:2,groupName:Carnations,flowerSet:[
  {flowers:[
{flowerCode:16,flowerName:Spray Carnations},
{flowerCode:17,flowerName:Standard Carnations}
]}
  ]}
  ]}

 To get to your data do something like this:

 myDataSetVar[0].rsJson[0].groupCode   (would give you 1)
 myDataSetVar[0].rsJson[1].flowerSet[0].flowers[1].flowerName  (would
 give you Standard Carnations)


 Really hope that helps and I haven't confused things further.

 All the best

 George


 On Dec 18, 9:04 am, jason maina jason.ma...@gmail.com wrote:
  Thanks Ryan guess was kind of tired had failed looking at some of the
  points
  rather was not getting the point. Finally I'm through this is the final
  product:
 
 
  {rsJson:[{groupCode:1,groupName:Roses,flowerSet:{flowers:[{flowerCode:15,flowerName:Roses}]}},{groupCode:2,groupName:Carnations,flowerSet:{flowers:[{flowerCode:16,flowerName:Spray
  Carnations},{flowerCode:17,flowerName:Standard
 
  Carnations}]}},{groupCode:3,groupName:Perennials,flowerSet:{flowers:[{flowerCode:2,flowerName:Aster},{flowerCode:3,flowerName:Alstromeria},{flowerCode:10,flowerName:Gysophila},{flowerCode:12,flowerName:Limonium
 
  Perezzi}]}},{groupCode:4,groupName:Annuals,flowerSet:{flowers:[{flowerCode:1,flowerName:Ammi
 
  Majus},{flowerCode:4,flowerName:Bupleurum},{flowerCode:5,flowerName:Carthamus},{flowerCode:6,flowerName:Chinese
 
  Aster},{flowerCode:7,flowerName:Chrysantemum},{flowerCode:8,flowerName:Delphinium},{flowerCode:13,flowerName:Lisianthus},{flowerCode:14,flowerName:Molucella},{flowerCode:18,flowerName:Statice},{flowerCode:19,flowerName:Stocks}]}},{groupCode:5,groupName:Bulbs,flowerSet:{flowers:[{flowerCode:9,flowerName:Freesia},{flowerCode:11,flowerName:Lilies}]}}]}
 
  kind regards
  Jason
 
  On Wed, Dec 17, 2008 at 8:04 PM, jason maina jason.ma...@gmail.com
  wrote:
   What im wondering out of the reply is I cant have a nested JSON
   object
   with
   the following layout?
 
   groupID, groupName, groupItems(array of items)
 
   similar example:
 
 
   http://labs.adobe.com/technologies/spry/samples/data_region/JSONDataS...
 
   Regards,
   Jason
 
   On Wed, Dec 17, 2008 at 7:02 PM, Ryan Gahl ryan.g...@gmail.com
   wrote:
 
   typo... ...with NO properties
 
   On Wed, Dec 17, 2008 at 10:02 AM, Ryan Gahl ryan.g...@gmail.com
   wrote:
 
   Here are your problems... I'll remove the bulk of the data to make
   it
   more clear:
 
   rsJson: {[{...}]}
 
   what you have is illegal. You're essentially saying you have an
   anonymous
   object with not properties and filling it with an array (that's
   probably not
   even totally accurate)... the bottom line is, 

[Proto-Scripty] Re: Adding properties to all form elements

2008-12-18 Thread kangax

On Dec 18, 12:18 pm, Kupido kup...@hotmail.com wrote:
 Unfortunately I need my application to be compatible with IE too... :(

 What about the initialization function?

 Object.extend(Form.Methods, {
         initialize: function (form)
         {
                 form = $(form);

                 form.property1 = 'test';
                 form.property2 = ['t', 'e', 's', 't'];

                 // and so on
         }

 });

 This is working for stardard forms but not for dinamically created
 forms (document.createElement). Why?
 Is there a better way of doing this?

I'm not sure how this could work and what exactly it does. A preferred
way to add properties to FORM elements is by using `Element.addMethods
('form', { /* ... */ })`. The only problem is that Prototype
discards any properties which are not functions (or rather those that
return falsy result from `Object.isFunction`). That is why your non-
function properties are never applied. This was brought up before but
doesn't seem like an important (or even necessary) addition. You can
always open a ticket, of course ; )

--
kangax
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Using Event.observe and checking for childNodes in a parent

2008-12-18 Thread Calvin Lai
Thanks Alex!
I'm going to give that a shot...and I see what you mean by seeing it in a
different way.

I'll let you know how it goes.

--
Calvin Lai
Business Development
http://dealspl.us


On Thu, Dec 18, 2008 at 1:27 AM, Alex Mcauley 
webmas...@thecarmarketplace.com wrote:


 I would look at the observe in a different way ...

 by that i mean observe the element that you are hovering not the whole
 window  this way the event will bubble up the DOM and can be stopped as
 bubbling goes up the document not down.. this is a quick and dirty tooltips
 script i wrote a few weeks ago which does the same thing you are trying to
 do

  tooltips : function() {
  $$(tooltipClass+' div').invoke('observe', 'mouseover', function(event)
 {event.stop();});
  $$(tooltipClass+' img').invoke('observe', 'mouseover', function(event)
 {event.stop();});
$$(tooltipClass).invoke('observe', 'mouseover', function(event) {
if($$(invokedTooltipClass).length = 1) {
 return;
}

var text=$(this).down(0).innerHTML;
if(text=='') {
 return;
}
   var width=(text.length*10)+'px';

   var x=Event.pointerX(event)-30;// horizontal (Left to Right)
   var y=Event.pointerY(event)+20; // vertical (Top to Bototm)

   var el = new Element('div', { 'class': 'tt','style' :

 'display:none;position:absolute;top:'+y+'px;left:'+x+'px;z-index:;max-width:300px;'
  }).update('div style=float:right;width:22px;margin-left:6px;img
 src=/resources/includes/images/help.png //div'+text);
   $(this).insert(el);
   Effect.Appear(el);
var att=this;
   Event.stop(event);

   $$(tooltipClass).invoke('observe', 'mouseout', function(event) {
$$('.tt').each(function(elem) {
  Effect.Fade(elem);
  $(elem).remove();
});
   });
  });
 }


 basically what it does is has an element with a classname in this case
 .tooltip ... inside the element is has a hidden span containing html

 div class=tooltipspan style=display:none;The HTML i want to
 display/spanThis is my tooltip Element ... Hover me to see the tip/div


 The first couple of lines stop the event bubbliing to the html i put into
 it
 (just an image and a div in this case) .. you can see how its not bubbled
 up
 the DOM and its all pretty self explanitory .. you can see the mouse out
 function too (that removes the created tip when its lost its hover) ..


 hope this helps a bit into understanding how things like this can be
 achieved


 Regards
 Alex








 - Original Message -
 From: Calvin L cal...@gmail.com
 To: Prototype  script.aculo.us 
 prototype-scriptaculous@googlegroups.com
 Sent: Wednesday, December 17, 2008 2:42 AM
 Subject: [Proto-Scripty] Using Event.observe and checking for childNodes in
 a parent


 
  Hi everyone,
 
  I've been baffled on day on how to get this done. I'm fairly new to
  Javascript and Prototype, so excuse me if I sound stupid!
 
  I have an element, that, when hovered over, displays an absolutely
  positioned div. This div has a bunch of other elements inside it,
  because it displays a lot of information. I'm trying to use
  Event.observe to tell prototype when to close the popup div. I only
  want it to show when hovered over, and disappear when the mouse moves
  outside of the popup. Here's my code:
 
  Event.observe(window, 'mouseover', function(event){
  var elem = Event.element(event);
  if(elem.id != prodElem){
  $(prodElem).hide();
  event.stop();
  }
  });
 
  where prodElem is the id of popup div. The problem is, when I hover
  over the other elements inside prodElem, it will hide the popup. There
  are a zillion elements in there and I don't want to have to list out
  all the elements. Is there some way to check for all childNodes within
  a parent node?
 
  Thanks for any help!
 
  Calvin
 
  
 


 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---