Page 1 of 1
Custom Data Source
Posted: Fri Mar 02, 2018 1:05 pm
by jclPTSG
Is there a way to remove the Current Data sources and Create a Custom one.
My clients don't know SQL and they would be confused with all the choices.
I would like to create my on GUI for a datasource.
thank you!
Re: Custom Data Source
Posted: Sat Mar 03, 2018 9:50 am
by Alex K.
Hello,
Please try to check the following code:
Code: Select all
<body>
<form id="form1" runat="server">
<cc3:StiWebDesigner runat="server"
ID="StiWebDesigner1" Localization="en.xml"
OnGetReport="StiWebDesigner1_GetReport"
OnCreateReport="StiWebDesigner1_CreateReport"
OnOpenReport="StiWebDesigner1_OpenReport"
OnPreviewReport="StiWebDesigner1_PreviewReport"
OnExit="StiWebDesigner1_Exit" />
</form>
<script type="text/javascript">
// where jsStiWebDesigner1 - "js" + Designer Id
//Override Dictionary NewItem Menu
var dictionaryNewItemMenu = jsStiWebDesigner1.options.menus.dictionaryNewItemMenu || jsStiWebDesigner1.InitializeDictionaryNewItemMenu();
dictionaryNewItemMenu.oldAction = dictionaryNewItemMenu.action;
dictionaryNewItemMenu.action = function (menuItem) {
this.changeVisibleState(false);
if (menuItem.key == "dataSourceNew") {
//write your code here
alert("New DataSource was clicked!")
}
else {
dictionaryNewItemMenu.oldAction(menuItem);
}
}
//Override Dictionary ContextMenu
var dictionaryContextMenu = jsStiWebDesigner1.options.menus.dictionaryContextMenu || jsStiWebDesigner1.InitializeDictionaryContextMenu();
dictionaryContextMenu.oldAction = dictionaryContextMenu.action;
dictionaryContextMenu.action = function (menuItem) {
this.changeVisibleState(false);
if (menuItem.key == "dataSourceNew") {
//write your code here
alert("New DataSource was clicked!")
}
else {
dictionaryContextMenu.oldAction(menuItem);
}
}
</script>
</body>
Thank you.
Re: Custom Data Source
Posted: Mon Mar 05, 2018 12:39 pm
by jclPTSG
Thank you for that.
I did have to modify the code that you sent. (had to add
jsObject to the lines below.)
Updated code below:
Code: Select all
var designer = new Stimulsoft.Designer.StiDesigner();
var dictionaryNewItemMenu = designer.jsObject.options.menus.dictionaryNewItemMenu || designer.jsObject.InitializeDictionaryNewItemMenu();
dictionaryNewItemMenu.oldAction = dictionaryNewItemMenu.action;
dictionaryNewItemMenu.action = function (menuItem) {
this.changeVisibleState(false);
if (menuItem.key == "dataSourceNew") {
//write your code here
alert("New DataSource was clicked!")
}
else {
dictionaryNewItemMenu.oldAction(menuItem);
}
}
//Override Dictionary ContextMenu
var dictionaryContextMenu = designer.jsObject.options.menus.dictionaryContextMenu || designer.jsObject.InitializeDictionaryContextMenu();
dictionaryContextMenu.oldAction = dictionaryContextMenu.action;
dictionaryContextMenu.action = function (menuItem) {
this.changeVisibleState(false);
if (menuItem.key == "dataSourceNew") {
//write your code here
alert("New DataSource was clicked!")
}
else {
dictionaryContextMenu.oldAction(menuItem);
}
}
Re: Custom Data Source
Posted: Wed Mar 07, 2018 5:58 am
by Alex K.
Hello
We are always glad to help you!
Please let us know if you need any additional help.
Thank you.