This topic is locked

Toobar Buttons

11/24/2009 6:49:37 PM
PHPRunner General questions
D
Dale author

I have created a toobar ribbon, for all the buttons that displayed on a list page.

So I have buttons for Delete selected, Edit selected, Print selected, etc etc etc.
What I want to do if control when they display.

For example, I do not want to show Edit Selected, Delete Selected, Export Selected, Print Selected Toolbar buttons if there is nothing checked in the list.
So, how would one check to see if Any rows are checked, if so show the toolbar buttons.

If none are selected dont show these toolbar buttons.
I have the hide or show function in place, I just dont know what values to check to see if I should display them.
So the question is, if you check the checkbox in the header column to select all, what value would I check in javascript to determine if I should show the buttons.

AND,

When I check individual rows, what value would I check to determine if I should show or hide the buttons.

I can check many rows in a list, (then the buttons should show) but if I uncheck all the rows the button should hide.
Its just what value do I check for. I have the function in place to handle the show or hide.
Hope that makes sense.
The toolbar is looking great. I just want to hide or show some icons based on the fact that there is or isnt any rows checked.
Any help would be appreciated

J
Jane 11/25/2009

Dale,
use List page: After record processed event to add onchage event for each checkbox:

$record["checkbox_attrs"].=" onchange='if ($(\"input[@type=checkbox][@checked][@name^=selection]\").length) {//show tool bar} else {//hide tool bar}' ";
D
Dale author 11/25/2009

Thanks Jane,

It worked as you suggested. BUT, I had to abandon the using of After Record Processed method.

You may want to look into this further, but I found that using this method, Phprunner was NOT applying the onchange to the checkbox_attrs on the first row when the list was produced. All subsequent rows had the added onchange event. Just not the first one.
But you gave me the hint I needed to make my method work.
I used the value input[@type=checkbox][@checked][@name^=selection]\").length in my IF condition in a toggle_icons function.

I list.htm and added a onclick event on the table cell holding the checkbox.

<td onclick="javascript: toggle_icons();"> So whenever a user clicks the checkbox on the row, it runs the script.

I modified the lheader.htm and added a <span onclick="javascript: toggle_icons();"> </span> around the select all toolbar Icon.
Last, I modified the list.php in the source and added the toggle_icons() function the the end of the bselect=!belected function.
It all works perfectly now. Thankyou for the tip.

A
aalekizoglou 11/26/2009

DaleM,
can you please post a screenshot of the toolbar ribon. Or PM/email me?
What have you used to create that ribbon. I have implemented a template for my projects, and redecorated the buttons with Photoshop self created glass buttons. But I find the ribbon way to be more appealing.
Regards,
Athanasios Alekizoglou

QUALISYS SOFTWARE



Thanks Jane,

It worked as you suggested. BUT, I had to abandon the using of After Record Processed method.

You may want to look into this further, but I found that using this method, Phprunner was NOT applying the onchange to the checkbox_attrs on the first row when the list was produced. All subsequent rows had the added onchange event. Just not the first one.
But you gave me the hint I needed to make my method work.
I used the value input[@type=checkbox][@checked][@name^=selection]\").length in my IF condition in a toggle_icons function.

I list.htm and added a onclick event on the table cell holding the checkbox.

<td onclick="javascript: toggle_icons();"> So whenever a user clicks the checkbox on the row, it runs the script.

I modified the lheader.htm and added a <span onclick="javascript: toggle_icons();"> </span> around the select all toolbar Icon.
Last, I modified the list.php in the source and added the toggle_icons() function the the end of the bselect=!belected function.
It all works perfectly now. Thankyou for the tip.

D
Dale author 11/27/2009

Sent pm