Page 1 of 1

Toolbar actions and disabled status

Posted: Sat Nov 30, 2013 10:36 pm
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!

Re: Toolbar actions and disabled status

Posted: Tue Dec 03, 2013 8:10 am
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.

Re: Toolbar actions and disabled status

Posted: Tue Dec 03, 2013 8:39 am
by poweredbyporkers
Brilliant, I'll get on to this and try it out now 8-)

Re: Toolbar actions and disabled status

Posted: Tue Dec 03, 2013 10:58 am
by HighAley
Hello.

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

Thank you.