Re: Variable numbers of rows
Ok still confused: I've got Names = { elements: {}, GUID: 0; update: function(id, value) { var realId = parseInt(id.split("_")[1], 10); Names.elements[realId] = value; }, add: function() { Names.GUID++; Names.elements[Names.GUID] = null; }, generateJSON: function() { return (Names.elements).toJSONString(); } } Obviously return (Names.elements).toJSONString(); is going to break because I don't implement this method So - how do I return a JSON string representation of my element object so I can populate the hidden field? Justin Jesse Kuhnert wrote: > You don't need a json javascript library, that's the whole point of > the protocol. You just eval ' it and you're on your way. > > If you want to get the response back correctly eval'd for you and such > you can implement the function: > > tapestry.loadJson=function(type, data, http, kwArgs){ } > > "data" will be your json object structure. Ie if you returned > something like {this:value,means:nothing} you'd be able to do: > > > tapestry.loadJson=function(type, data, http, kwArgs){ > alert("Hey what does it mean?: " + data["means"]); > } > -- Justin Walsh http://www.ewage.co.za - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Variable numbers of rows
Justin Walsh wrote: D'oh Just realised that eval is for converting text to object. Sorry. -- Justin Walsh - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Variable numbers of rows
Ok - I'm stumbling at the first hurdle here then. I know that this is JSON question but its in the context of this example. I'm looking at: http://www.json.org/js.html and trying to follow their example: So I have var myJSONObject = {"bindings": [ {"ircEvent": "PRIVMSG", "method": "newURI", "regex": "^http://.*"}, {"ircEvent": "PRIVMSG", "method": "deleteURI", "regex": "^delete.*"}, {"ircEvent": "PRIVMSG", "method": "randomURI", "regex": "^random.*"} ] }; But when I call: var myObject = eval('(' + myJSONObject + ')'); I get missing ] after element list http://localhost:8080/prototypes/FirstJSON.html# Line 79 What am I doing wrong? Jesse Kuhnert wrote: > You don't need a json javascript library, that's the whole point of > the protocol. You just eval ' it and you're on your way. > > If you want to get the response back correctly eval'd for you and such > you can implement the function: > > tapestry.loadJson=function(type, data, http, kwArgs){ } > > "data" will be your json object structure. Ie if you returned > something like {this:value,means:nothing} you'd be able to do: > > > tapestry.loadJson=function(type, data, http, kwArgs){ > alert("Hey what does it mean?: " + data["means"]); > } > -- Justin Walsh http://www.ewage.co.za - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Variable numbers of rows
You don't need a json javascript library, that's the whole point of the protocol. You just eval ' it and you're on your way. If you want to get the response back correctly eval'd for you and such you can implement the function: tapestry.loadJson=function(type, data, http, kwArgs){ } "data" will be your json object structure. Ie if you returned something like {this:value,means:nothing} you'd be able to do: tapestry.loadJson=function(type, data, http, kwArgs){ alert("Hey what does it mean?: " + data["means"]); } On 2/21/07, Justin Walsh <[EMAIL PROTECTED]> wrote: Hi, Very interested in this topic. Just a typo: elements: [], Also changed: return (Names.elements).toJSONString(); to return JSONstring.make(Names.elements); Not sure if this last change is correct - still having problems with the JSON js library: Stupid question - how do you include the JSON javascript library. I was under the impression it was included automatically - but I'm getting: JSONstring is not defined http://localhost:8080/prototypes/FirstJSON.html# Line 76 I'm using tapestry 4.1.1 and have the following in my html: ... ... Thanks Jesse Kuhnert wrote: > Well, I just assumed ~everyone~ must be using 4.1 by now. =p > > On 2/20/07, Matt Brock <[EMAIL PROTECTED]> wrote: >> -- Justin Walsh - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jesse Kuhnert Tapestry/Dojo team member/developer Open source based consulting work centered around dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Variable numbers of rows
Hi, Very interested in this topic. Just a typo: elements: [], Also changed: return (Names.elements).toJSONString(); to return JSONstring.make(Names.elements); Not sure if this last change is correct - still having problems with the JSON js library: Stupid question - how do you include the JSON javascript library. I was under the impression it was included automatically - but I'm getting: JSONstring is not defined http://localhost:8080/prototypes/FirstJSON.html# Line 76 I'm using tapestry 4.1.1 and have the following in my html: ... ... Thanks Jesse Kuhnert wrote: > Well, I just assumed ~everyone~ must be using 4.1 by now. =p > > On 2/20/07, Matt Brock <[EMAIL PROTECTED]> wrote: >> -- Justin Walsh - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Variable numbers of rows
Yes, tapestry will also use hidden fields to manage the state, but you don't have to worry about it. On 2/20/07, Jesse Kuhnert <[EMAIL PROTECTED]> wrote: I think T4.1 does this sort of mundane state mgmt kind of stuff for you. On 2/19/07, Michael Prescott <[EMAIL PROTECTED]> wrote: > Sorry, Tapestry 4.0. > > -Original Message- > From: Mark Stang [mailto:[EMAIL PROTECTED] > Sent: February 19, 2007 4:46 PM > To: Tapestry users; tapestry-user@jakarta.apache.org > Subject: RE: Variable numbers of rows > > Which version of Tapestry are you using? > > Mark J. Stang > Senior Engineer/Architect > office: +1 303.468.2900 > mobile: +1 303.507.2833 > Ping Identity > > > > -Original Message- > From: Michael Prescott [mailto:[EMAIL PROTECTED] > Sent: Mon 2/19/2007 2:29 PM > To: tapestry-user@jakarta.apache.org > Subject: Variable numbers of rows > > We've got a couple of forms where users can edit a list of items, and > also add new items to the bottom. We're currently doing this by sending > preset number of hidden rows, revealed as necessary by Javascript - > although this is a little lame. > > It seems that components like @For are designed to handle changes in the > backing data set that originate on the server, but not on the client. > There are hidden fields that need maintenance, for one thing. > > Is there a common approach for this sort of scenario? Off the top of my > head, it looks like I might need to implement something like @For, but > which has a well-known (or at least published) contract in terms of the > hidden field maintenance that would be required. > > Any clues or pointers would be much appreciated. > > Michael > > > Michael Prescott > direct: 416.646.7062 > > main: 416.646.7000 > fax: 416.646.7050 > > Exchange Solutions Inc. > 250 Yonge Street, 18th Floor > Toronto, ON M5B 2L7 > www.exchangesolutions.com > > > > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- Jesse Kuhnert Tapestry/Dojo team member/developer Open source based consulting work centered around dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Variable numbers of rows
I think T4.1 does this sort of mundane state mgmt kind of stuff for you. On 2/19/07, Michael Prescott <[EMAIL PROTECTED]> wrote: Sorry, Tapestry 4.0. -Original Message- From: Mark Stang [mailto:[EMAIL PROTECTED] Sent: February 19, 2007 4:46 PM To: Tapestry users; tapestry-user@jakarta.apache.org Subject: RE: Variable numbers of rows Which version of Tapestry are you using? Mark J. Stang Senior Engineer/Architect office: +1 303.468.2900 mobile: +1 303.507.2833 Ping Identity -Original Message- From: Michael Prescott [mailto:[EMAIL PROTECTED] Sent: Mon 2/19/2007 2:29 PM To: tapestry-user@jakarta.apache.org Subject: Variable numbers of rows We've got a couple of forms where users can edit a list of items, and also add new items to the bottom. We're currently doing this by sending preset number of hidden rows, revealed as necessary by Javascript - although this is a little lame. It seems that components like @For are designed to handle changes in the backing data set that originate on the server, but not on the client. There are hidden fields that need maintenance, for one thing. Is there a common approach for this sort of scenario? Off the top of my head, it looks like I might need to implement something like @For, but which has a well-known (or at least published) contract in terms of the hidden field maintenance that would be required. Any clues or pointers would be much appreciated. Michael Michael Prescott direct: 416.646.7062 main: 416.646.7000 fax: 416.646.7050 Exchange Solutions Inc. 250 Yonge Street, 18th Floor Toronto, ON M5B 2L7 www.exchangesolutions.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jesse Kuhnert Tapestry/Dojo team member/developer Open source based consulting work centered around dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Variable numbers of rows
Sorry, Tapestry 4.0. -Original Message- From: Mark Stang [mailto:[EMAIL PROTECTED] Sent: February 19, 2007 4:46 PM To: Tapestry users; tapestry-user@jakarta.apache.org Subject: RE: Variable numbers of rows Which version of Tapestry are you using? Mark J. Stang Senior Engineer/Architect office: +1 303.468.2900 mobile: +1 303.507.2833 Ping Identity -Original Message- From: Michael Prescott [mailto:[EMAIL PROTECTED] Sent: Mon 2/19/2007 2:29 PM To: tapestry-user@jakarta.apache.org Subject: Variable numbers of rows We've got a couple of forms where users can edit a list of items, and also add new items to the bottom. We're currently doing this by sending preset number of hidden rows, revealed as necessary by Javascript - although this is a little lame. It seems that components like @For are designed to handle changes in the backing data set that originate on the server, but not on the client. There are hidden fields that need maintenance, for one thing. Is there a common approach for this sort of scenario? Off the top of my head, it looks like I might need to implement something like @For, but which has a well-known (or at least published) contract in terms of the hidden field maintenance that would be required. Any clues or pointers would be much appreciated. Michael Michael Prescott direct: 416.646.7062 main: 416.646.7000 fax: 416.646.7050 Exchange Solutions Inc. 250 Yonge Street, 18th Floor Toronto, ON M5B 2L7 www.exchangesolutions.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Variable numbers of rows
Which version of Tapestry are you using? Mark J. Stang Senior Engineer/Architect office: +1 303.468.2900 mobile: +1 303.507.2833 Ping Identity -Original Message- From: Michael Prescott [mailto:[EMAIL PROTECTED] Sent: Mon 2/19/2007 2:29 PM To: tapestry-user@jakarta.apache.org Subject: Variable numbers of rows We've got a couple of forms where users can edit a list of items, and also add new items to the bottom. We're currently doing this by sending preset number of hidden rows, revealed as necessary by Javascript - although this is a little lame. It seems that components like @For are designed to handle changes in the backing data set that originate on the server, but not on the client. There are hidden fields that need maintenance, for one thing. Is there a common approach for this sort of scenario? Off the top of my head, it looks like I might need to implement something like @For, but which has a well-known (or at least published) contract in terms of the hidden field maintenance that would be required. Any clues or pointers would be much appreciated. Michael Michael Prescott direct: 416.646.7062 main: 416.646.7000 fax: 416.646.7050 Exchange Solutions Inc. 250 Yonge Street, 18th Floor Toronto, ON M5B 2L7 www.exchangesolutions.com