How to introduce custom buttons in UI toolbar?
How to introduce custom buttons in UI toolbar?
I would like to introduce couple of buttons to UI toolbar. is it easy to extend?
If not, I would like to simply fire a javascript function when user clicks on "Design" button. What is simplest of doing this without modifying source code?
Please Note - I am using mobile version (html5 designer).
Also is there a roadmap somewhere as what we can expect in upcoming .2 release?
Thanks,
-bobsov
If not, I would like to simply fire a javascript function when user clicks on "Design" button. What is simplest of doing this without modifying source code?
Please Note - I am using mobile version (html5 designer).
Also is there a roadmap somewhere as what we can expect in upcoming .2 release?
Thanks,
-bobsov
Re: How to introduce custom buttons in UI toolbar?
Hello,
Please see the sampe code following:
Thank you.
Please see the sampe code following:
Code: Select all
<div>
<cc2:StiMobileViewer ID="StiMobileViewer1" ShowDesignButton="true" runat="server" />
</div>
<script type="text/javascript">
jsStiMobileViewer1.options.buttons.Design.action = function () { alert("Design button pressed!"); }
//where 'StiMobileViewer1' - mobile viewer Id;
//Example insert user button
var userButton = jsStiMobileViewer1.StandartSmallButton("userButton", null, "My Button", "emptyImage"); //(name, groupName, caption, imageName, toolTip, arrow);
userButton.image.src = "http://www.stimulsoft.com/media/mod_falang/images/usa.gif";
userButton.action = function () { alert("User button pressed!"); }
var toolbarTable = jsStiMobileViewer1.options.toolbar.innerContent.firstChild;
toolbarTable.addCell(userButton);
</script>
Re: How to introduce custom buttons in UI toolbar?
You are awesome Aleksey.
Thank you very much.
Thank you very much.
Re: How to introduce custom buttons in UI toolbar?
Hello Aleskey:
Can you also show how to add menu options in that user button?
Thank you for all your help in this.
Can you also show how to add menu options in that user button?
Thank you for all your help in this.
Re: How to introduce custom buttons in UI toolbar?
Hello,
Please check the following code:
Thank you.
Please check the following code:
Code: Select all
<div>
<cc2:StiMobileViewer ID="StiMobileViewer1" ShowDesignButton="true" runat="server" />
</div>
<script type="text/javascript">
//Example insert user button
var userButton = jsStiMobileViewer1.StandartSmallButton("userButton", null, "My Button", "emptyImage"); //(name, groupName, caption, imageName, toolTip, arrow);
userButton.image.src = "http://www.stimulsoft.com/media/mod_falang/images/usa.gif";
//where 'StiMobileViewer1' - mobile viewer Id;
var toolbarTable = jsStiMobileViewer1.options.toolbar.innerContent.firstChild;
toolbarTable.addCell(userButton);
//create menu items
var items = [];
items.push(jsStiMobileViewer1.Item("menuItem1", "Menu Item 1", null, "MenuItemKey1")); // (name, caption, imageName, key)
items.push(jsStiMobileViewer1.Item("menuItem2", "Menu Item 2", null, "MenuItemKey2"));
//create menu
var userMenu = jsStiMobileViewer1.VerticalMenu("userMenu", userButton, "Down", items, jsStiMobileViewer1.GetStyles("MenuStandartItem")); //(name, parentButton, animDirection, items, itemsStyles)
//show menu action
userButton.action = function () { userMenu.changeVisibleState(!userMenu.visible); }
//menu action
userMenu.action = function (menuItem) {
userMenu.changeVisibleState(false);
alert(menuItem.key);
}
</script>
Re: How to introduce custom buttons in UI toolbar?
Aleskey: You are awesome.
Re: How to introduce custom buttons in UI toolbar?
Hello,
We are always glad to help you!
Let us know if you need any additional help.
Thank you.
We are always glad to help you!
Let us know if you need any additional help.
Thank you.
Re: How to introduce custom buttons in UI toolbar?
Got one last question in this topic.
It allows you to define image name but where do you store it so that stimulsoft can render it properly?
Thank you for all your help.
It allows you to define image name but where do you store it so that stimulsoft can render it properly?
Thank you for all your help.
Re: How to introduce custom buttons in UI toolbar?
Hello,
Our images stored as internal resources. You can use the following code for redefine:
//create menu items
var items = [];
items.push(jsStiMobileViewer1.Item("menuItem1", "Menu Item 1", "emptyImage", "MenuItemKey1")); // (name, caption, imageName, key)
items.push(jsStiMobileViewer1.Item("menuItem2", "Menu Item 2", "emptyImage", "MenuItemKey2"));
//create menu
var userMenu = jsStiMobileViewer1.VerticalMenu("userMenu", userButton, "Down", items, jsStiMobileViewer1.GetStyles("MenuStandartItem")); //(name, parentButton, animDirection, items, itemsStyles)
userMenu.items["menuItem1"].image.src = "http://www.stimulsoft.com/media/mod_fal ... ges/fr.gif";
userMenu.items["menuItem2"].image.src = "http://www.stimulsoft.com/media/mod_fal ... ges/de.gif";
Thank you.
Our images stored as internal resources. You can use the following code for redefine:
//create menu items
var items = [];
items.push(jsStiMobileViewer1.Item("menuItem1", "Menu Item 1", "emptyImage", "MenuItemKey1")); // (name, caption, imageName, key)
items.push(jsStiMobileViewer1.Item("menuItem2", "Menu Item 2", "emptyImage", "MenuItemKey2"));
//create menu
var userMenu = jsStiMobileViewer1.VerticalMenu("userMenu", userButton, "Down", items, jsStiMobileViewer1.GetStyles("MenuStandartItem")); //(name, parentButton, animDirection, items, itemsStyles)
userMenu.items["menuItem1"].image.src = "http://www.stimulsoft.com/media/mod_fal ... ges/fr.gif";
userMenu.items["menuItem2"].image.src = "http://www.stimulsoft.com/media/mod_fal ... ges/de.gif";
Thank you.
Re: How to introduce custom buttons in UI toolbar?
Thank you very much for quick answer.
Last edited by bobsov on Fri Aug 22, 2014 3:45 pm, edited 1 time in total.