RE:RE: [Zope] How do you replace content with an action?
Hi Tom, Yes I have been struggling with this issue this week. The whole big picture is that I need to sort my table which contains the data from a zsql method. But, I have several elements that I need to deal with. First of all, my page template contains a requested expand/collapse feature using javascript that once a row of data is clicked a new table will expand that contains more related data of that row. I have to paths: 1)I have javascript already that will sort the visible data in my table but it will not sort the corresponding hidden table that is visible when clicked. So, when I click a row of data the wrong hidden table displays. 2)This is why I was looking at finding a way to redefine the results by clicking on the appropriate header. So, I wanted each heading on my table to trigger the right zsql method that already contains the desired sort and reassigning it to the batch results and then display accordingly. So, I don't know which path to continue with and beat with a stick till I get it working. Thanks, Laura
Laura, You sound like one very determined person. You are addressing a population of very smart ppl. Just give more detail, eg code examples. Best luck, David ----- Original Message ----- From: "Laura McCord" <Laura.McCord@doucet-austin.com> To: <tpassin@mitretek.org>; <zope@zope.org> Sent: Friday, September 03, 2004 7:33 AM Subject: RE:RE: [Zope] How do you replace content with an action? Hi Tom, Yes I have been struggling with this issue this week. The whole big picture is that I need to sort my table which contains the data from a zsql method. But, I have several elements that I need to deal with. First of all, my page template contains a requested expand/collapse feature using javascript that once a row of data is clicked a new table will expand that contains more related data of that row. I have to paths: 1)I have javascript already that will sort the visible data in my table but it will not sort the corresponding hidden table that is visible when clicked. So, when I click a row of data the wrong hidden table displays. 2)This is why I was looking at finding a way to redefine the results by clicking on the appropriate header. So, I wanted each heading on my table to trigger the right zsql method that already contains the desired sort and reassigning it to the batch results and then display accordingly. So, I don't know which path to continue with and beat with a stick till I get it working. Thanks, Laura _______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Laura, as somebody else told you in an other thread, you must be careful to distinguish between what happens on the server and and what on the client. Zope and it's tools work solely on the the server, java script only on the server. Tal templates work on the server to prepare a html page that zoope will send to your client. Once it is there your java script can deal with it. This two phases are run in total isolation and neither of the two is avare of the other. Furthermore, there is no easy way for the two, to communicate. Knowing this, we have two strategies to solve your problem of "local" refinement of a querry.: - send everything to the client. Unwanted parts hidden from view. Let your java script "unhide" and "rehide" the details as needed. This is fast, if ther is only a small and predictable amount of data to move between server and client. - create a new request and resend the result of the query with one detail record "filled out" each time a detail is requested. This approach does not involve any java script. I did send you a link to a sample how to do that. Maybe you have a look at it, and ask me if you need more explanations. Robert Laura McCord wrote:
Hi Tom,
Yes I have been struggling with this issue this week. The whole big picture is that I need to sort my table which contains the data from a zsql method. But, I have several elements that I need to deal with.
First of all, my page template contains a requested expand/collapse feature using javascript that once a row of data is clicked a new table will expand that contains more related data of that row.
I have to paths:
1)I have javascript already that will sort the visible data in my table but it will not sort the corresponding hidden table that is visible when clicked. So, when I click a row of data the wrong hidden table displays.
2)This is why I was looking at finding a way to redefine the results by clicking on the appropriate header. So, I wanted each heading on my table to trigger the right zsql method that already contains the desired sort and reassigning it to the batch results and then display accordingly.
So, I don't know which path to continue with and beat with a stick till I get it working.
Thanks, Laura
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
From: "robert rottermann" <robert@redcor.ch> To: "Laura McCord" <Laura.McCord@doucet-austin.com>
Laura,
as somebody else told you in an other thread, you must be careful to distinguish between what happens on the server and and what on the client. Zope and it's tools work solely on the the server, java script only on the server. Tal templates work on the server to prepare a html page that zoope will send to your client. Once it is there your java script can deal with it.
This two phases are run in total isolation and neither of the two is avare of the other. Furthermore, there is no easy way for the two, to communicate.
I haven't been paying too much attention to this thread, but the comment 'there is no easy way for the two to communicate' caught my attention. You can set up, quite easily, a way for your client-side javascript to communicate with the server-side zope which is invisible (well, to the non-technical) to the end-user. Start by creating a hidden iframe in your html page (call this 'Page 1'). Set the initial url to be loaded to point to a method on the zope server. The method on the zope server does some action (ie. a db lookup) and assigns the results to javascript variables; the key piece is to have some html in the method which has a javascript 'onload' command which invokes a javascript function (which is defined in the code for 'Page 1'); this js function does something with the js variables that were created by the zope method and modifies the display on 'Page 1'. Very kewl way to load a single page and then keep it updated with info from the server (ie. you can use js to keep loading zope methods into the iframe and then handle the returned data)! HTH Jonathan
Jonathan, tough your solution is a clever way to easen the burden of a partial page update, it does not not alter the fact, that javascript can not talk to the server. It only can submit a call to the server, asking it to send a new page. Whether this new page replaces the actual or a new frame (or the content of an iframe) is an other question. It is a common error, and I have the impression Laura has fallen prey to it, not to clearly separate the server and client "place of action". Robert Jonathan Hobbs wrote:
From: "robert rottermann" <robert@redcor.ch> To: "Laura McCord" <Laura.McCord@doucet-austin.com>
Laura,
as somebody else told you in an other thread, you must be careful to distinguish between what happens on the server and and what on the client. Zope and it's tools work solely on the the server, java script only on the server. Tal templates work on the server to prepare a html page that zoope will send to your client. Once it is there your java script can deal with it.
This two phases are run in total isolation and neither of the two is avare of the other. Furthermore, there is no easy way for the two, to communicate.
I haven't been paying too much attention to this thread, but the comment 'there is no easy way for the two to communicate' caught my attention.
You can set up, quite easily, a way for your client-side javascript to communicate with the server-side zope which is invisible (well, to the non-technical) to the end-user.
Start by creating a hidden iframe in your html page (call this 'Page 1'). Set the initial url to be loaded to point to a method on the zope server. The method on the zope server does some action (ie. a db lookup) and assigns the results to javascript variables; the key piece is to have some html in the method which has a javascript 'onload' command which invokes a javascript function (which is defined in the code for 'Page 1'); this js function does something with the js variables that were created by the zope method and modifies the display on 'Page 1'.
Very kewl way to load a single page and then keep it updated with info from the server (ie. you can use js to keep loading zope methods into the iframe and then handle the returned data)!
HTH
Jonathan
robert rottermann wrote:
Jonathan, tough your solution is a clever way to easen the burden of a partial page update, it does not not alter the fact, that javascript can not talk to the server. It only can submit a call to the server, asking it to send a new page. Whether this new page replaces the actual or a new frame (or the content of an iframe) is an other question.
It is a common error, and I have the impression Laura has fallen prey to it, not to clearly separate the server and client "place of action".
Robert
hm... actually, using XML-RPC is is possible to make Javscript talk to the server. In theroy at least. This may be lots more that Laura needs for sorting tables, but here are some relevant links from a google search: http://www.scottandrew.com/xml-rpc/ http://www.vcdn.org/Public/XMLRPC/ http://xmlrpc.kollhof.net/jsolait.xmlrpc/index.xhtml http://jsolait.net/ tthere is a whole bunch of other JavSAcropt XML-RPC stuff avialable all over the internet. And there even is a Zope-product that talks to a Zope Server with XML-RPC: http://mjablonski.zope.de/Epoz and I think Epoz is JavaScript only (unless I am wrong of course). /dario -- -- ------------------------------------------------------------------- Dario Lopez-Kästen, IT Systems & Services Chalmers University of Tech.
On Sat, Sep 04, 2004 at 07:05:24AM +0200, robert rottermann wrote: [snip]
- create a new request and resend the result of the query with one detail record "filled out" each time a detail is requested. This approach does not involve any java script. I did send you a link to a sample how to do that. Maybe you have a look at it, and ask me if you need more explanations.
Let me re-state the above suggestion to see if I have it right: 1. Client makes a generic request. 2. Server sends a response containing hyperlinks. Each of these links "drills down" to a more specific request. 3. Client clicks on one of the links to get the specific information s/he wants. 4. Server delivers the specific information. This Web application style is known as REST (representational state transfer). It's fairly well documented and is considered, by its proponents to be quite strong. Here is a link: http://c2.com/cgi/wiki?RestArchitecturalStyle Zope seems well suited for implementing applications in this style. You can find hints for a simple method of doing the dispatching based on the URL path here: http://zope.org/Members/dkuhlman/ZopeHowToNotes/#traversing-a-url-path If you have corrections or suggestions for this document, please send them to me. Dave [snip] -- Dave Kuhlman http://www.rexx.com/~dkuhlman
Dave,
Let me re-state the above suggestion to see if I have it right:
1. Client makes a generic request.
2. Server sends a response containing hyperlinks. Each of these links "drills down" to a more specific request.
3. Client clicks on one of the links to get the specific information s/he wants.
4. Server delivers the specific information.
far better expressed than I did
This Web application style is known as REST (representational state transfer). It's fairly well documented and is considered, by its proponents to be quite strong. Here is a link:
Thanks for the link. I was not aware of REST as a concept.
Zope seems well suited for implementing applications in this style.
You can find hints for a simple method of doing the dispatching based on the URL path here:
http://zope.org/Members/dkuhlman/ZopeHowToNotes/#traversing-a-url-path thanks for this document. I looks to be a real nice summing up. And I finally learned how to access a webdav resource from kate :)
robert
participants (6)
-
Dario Lopez-Kästen -
Dave Kuhlman -
David Hassalevris -
Jonathan Hobbs -
Laura McCord -
robert rottermann