Toolbar actions and disabled status

Stimulsoft Reports.WEB discussion
Post Reply
User avatar
poweredbyporkers
Posts: 28
Joined: Fri Nov 29, 2013 8:42 pm

Toolbar actions and disabled status

Post by poweredbyporkers »

My application uses a metro style footer with per view actions that can be performed. When I was trialing a competitors product last week I hid the toolbar and wrote a little jQuery to detect when the css class was modified on buttons in the toolbar and then applied the same disabled status to my footer buttons. I also hijacked the actions so my toolbar controlled the report.

Anyway, on to my question(s).

Image

1. How can I detect the disabled status of the buttons in your toolbar?
2. How can I call the action associated with the function I'm after i.e. export to pdf or go to next page etc?
3. How can I start the report in "fit page width" mode?

Hopefully these aren't dumb questions!
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Toolbar actions and disabled status

Post by HighAley »

Hello.
poweredbyporkers wrote:1. How can I detect the disabled status of the buttons in your toolbar?
You could get buttons collection with next code:

Code: Select all

var buttons = jsMvcViewer1.options.buttons; //object jsMvcViewer1 - where 'MvcViewer1' = id of Mvc Viewer;
You could get status of any button by its' name with next code:

Code: Select all

buttons["NextPage"].isDisable
poweredbyporkers wrote:2. How can I call the action associated with the function I'm after i.e. export to pdf or go to next page etc?
Here is a code how to get onClick event of the toolbar button:

Code: Select all

    var nextPageButton = buttons["NextPage"];
    yourButton.onclick = nextPageButton.onclick;
and here is code how to get onClick event of drop-down menu item:

Code: Select all

    var saveMenuItems = buttons["Save"].menu.itemsArray;
    for (var i in saveMenuItems) {
        if (saveMenuItems[i].itemName == "SavePdf") {
            yourButton.onclick = saveMenuItems[i].onclick;
            break;
        }
    }
poweredbyporkers wrote:3. How can I start the report in "fit page width" mode?
Here is code how to set page zoom:

Code: Select all

 var zoomMenuItems = buttons["Zoom"].menu.itemsArray;
    for (var i in zoomMenuItems) {
        if (zoomMenuItems[i].itemName == "ZoomPageWidth") {
            zoomMenuItems[i].onclick();
            break;
        }
    }
Thank you.
User avatar
poweredbyporkers
Posts: 28
Joined: Fri Nov 29, 2013 8:42 pm

Re: Toolbar actions and disabled status

Post by poweredbyporkers »

Brilliant, I'll get on to this and try it out now 8-)
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Toolbar actions and disabled status

Post by HighAley »

Hello.

We are always glad to help you.
Let us know if you need any additional help.

Thank you.
Post Reply