Putting a print button on my page - "Add helpers to snapshot and pass objects in request parameters"

17 views
Skip to first unread message

riley

unread,
Jun 30, 2016, 9:13:21 AM6/30/16
to Lift
I have been doing the research on putting a print button that will take the contents of my page - a simple HTML table - maybe open up a popup or a dialog and printing the contents of the page on pressing the button.]
What is the fastest way to do this?

My research led me to these links below:



and I click on the below link to see what is at the other end of the link, 
(In revision:614098d4098bd6ce89e529f8638e877b440be92c) Closes #978. Added snapshot capability to RequestVar and allow RequestVar to be put in groups and snapshotted as a group

I created an Assembla account just to access this, but I get a Not Permitted page,
Anyway. I wanted to know jhow #978 was closed and where in the Lift source I can find the implementation that solves the original OP's question of putting a print button, which happens to be exactly what I want also.

thanks for your time

Antonio Salazar Cardozo

unread,
Jul 1, 2016, 10:42:05 AM7/1/16
to Lift
You can use `SHtml.link` to build a link that runs a function that sets the
request var appropriately.

A quick example:

val myEntity = currentEntity.is

"a [href]" #> SHtml.link("/url/to/thing", () => currentEntity(myEntity), _)

This will point to /url/to/thing, but append a query parameter that will
ensure that `currentEntity` gets set to its previous value.

The flip side of this is I would suggest trying to structure your URL
such that this isn't necessary, perhaps by having `/entity/id` and using
a Menu.param to look up the appropriate object.

But, if that won't work, SHtml.link should!
Thanks,
Antonio
Reply all
Reply to author
Forward
0 new messages