This topic is locked

'Preview All' or 'Expand All'

7/8/2009 9:29:32 PM
ASPRunnerPro General questions
jtksmith author

I really like the "Preview" option that allows viewing of the Details from the List; however, there are times when it would be nice to preview the details for multiple items in a list at the same time without having to manually click the preview for each list item. Is there a way to create a "Preview All" or "Expand All" link or button that would accomplish this?
Conversely, assuming the above is possible, how would you also create a "Hide All" or "Collapse All" link or button?

J
Jane 7/9/2009

Jeremy,
this task some custom coding on the Visual Editor tab.

Here is a sample 'Preview selected' button:

<input type=button class=button value="Preview selected" onclick="$('input[@type=checkbox][@checked][@id^=check]').each(function(i){

if(!isNaN(parseInt(this.id.substr(5))))

$('a#DetailTableName_preview'+this.id.substr(5)).click();});">

jtksmith author 7/9/2009

Jane,
That's awsome, thank you.

L
luic 7/14/2009

Can you give me an exact example with some explanations for this Preview function on selected records? I copied the sample code and replaced with the table name and it does not work.
Thanks.

J
Jane 7/15/2009

Hi,
this code works for Preview detail records inline option only.

jtksmith author 7/22/2009

Chris,
It is amazingly simple. Using the code provided by Jane, here are the steps that worked for me.

  1. Go into Visual Editor of the List page you want to add the functionality to.
  2. Click on the "Print Selected" button to select it.
  3. Find "{END printselected_link}" which should be highligted because of step 2.
  4. Paste the code [codebox]<input type=button class=button value="Preview selected" onclick="$('input[@type=checkbox][@checked][@id^=check]').each(function(i){

    if(!isNaN(parseInt(this.id.substr(5))))

    $('a#DetailTableName_preview'+this.id.substr(5)).click();});">[/codebox] immediately following the "}" in the code in step 3.
    That's it.
    Now, when you select multiple checkboxes of a master record that you want to see preview the details for they will expand by clicking the newly created "Preview selected" button. To make them all collapse, simply click the button again. If you want to leave some of them open, uncheck them before re-clicking the "Preview selected" button.
    Hope this helps.

L
luic 7/24/2009

Thanks Jeremy. It works great!
CHRIS.

Chris,

It is amazingly simple. Using the code provided by Jane, here are the steps that worked for me.

  1. Go into Visual Editor of the List page you want to add the functionality to.
  2. Click on the "Print Selected" button to select it.
  3. Find "{END printselected_link}" which should be highligted because of step 2.
  4. Paste the code [codebox]<input type=button class=button value="Preview selected" onclick="$('input[@type=checkbox][@checked][@id^=check]').each(function(i){

    if(!isNaN(parseInt(this.id.substr(5))))

    $('a#DetailTableName_preview'+this.id.substr(5)).click();});">[/codebox] immediately following the "}" in the code in step 3.
    That's it.
    Now, when you select multiple checkboxes of a master record that you want to see preview the details for they will expand by clicking the newly created "Preview selected" button. To make them all collapse, simply click the button again. If you want to leave some of them open, uncheck them before re-clicking the "Preview selected" button.
    Hope this helps.

jtksmith author 10/7/2009

There are two important pieces to this puzzle required to make it work that I neglected to mention, the first is that the preview type must be "inline" and not "popup". This is determined when linking tables in the Datasource tables step. The second piece is that you must switch to source code between steps 2 and 3 when in Visual Editor. I assumed that was obvious but realized one should never assume something is obvious. Hopefully this helps anyone that might have had problems with the code.
Cheers <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=44513&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' />

D
dunga 12/2/2009



Jeremy,
this task some custom coding on the Visual Editor tab.

Here is a sample 'Preview selected' button:


Hi, Jane, what if you have two detail tables, how would the code change???

......

I understood, just add another button and change the DetailTableName. This is great!!!

Thanks.