如何在javascript中添加SQL服务器数据到打开窗口 [英] How to add SQL server data to open window in javascript
本文介绍了如何在javascript中添加SQL服务器数据到打开窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我希望在MVC中的devexpress仪表板中点击枢轴网格中的一行时显示一个窗口。
在该窗口中我想显示该网格列的背景数据。
请帮助我。我是网络开发的新手。
我尝试了什么:
我在视图中为仪表板devexpress分配了Itemclick事件。我服用后一个javascript函数并将该函数传递给视图。
Index.cshtml
Hi,
I want to display one window on clicking a row in pivot grid in devexpress dashboards in MVC.
In that window I want to display background data of that grid column.
Please help me.I am new to web development.
What I have tried:
I have assigned Itemclick event for a dashboard devexpress in a view.After I have taken one javascript function and passed that function to the view.
Index.cshtml
<div>
@Html.DevExpress().Dashboard(settings =>
{
settings.Name = "clientDashboardDesigner1";
settings.WorkingMode = Model;
settings.Width = Unit.Percentage(100);
settings.Height = Unit.Percentage(100);
settings.AllowExportDashboardItems = true;
settings.IncludeDashboardIdToUrl = true;
settings.IncludeDashboardStateToUrl = true;
settings.ClientSideEvents.CustomizeMenuItems = "onCustomizeMenuItems";
settings.ClientSideEvents.BeforeRender = "onBeforeRender";
settings.ClientSideEvents.ItemClick = "function(s, e) { onItemClick(s, e, $(this)); }";
}).GetHtml()
</div>
我的Scripts.js代码
My Scripts.js code
function onItemClick(s, e) {
var i, l, options = [{
value: 'first',
text: 'First'
}, {
value: 'second',
text: 'Second'
}],
newWindow = window.open("", null, "height=200,width=400,status=yes,toolbar=no,menubar=no,location=no");
newWindow.document.write("<" + "My Data" + "/>");// Here I want to pass the background data
//That data comes from Excel sheet
}
推荐答案
(this)); };
})。GetHtml()
< / div < span class =code-keyword>>
(this)); }"; }).GetHtml() </div>
我的Scripts.js代码
My Scripts.js code
function onItemClick(s, e) {
var i, l, options = [{
value: 'first',
text: 'First'
}, {
value: 'second',
text: 'Second'
}],
newWindow = window.open("", null, "height=200,width=400,status=yes,toolbar=no,menubar=no,location=no");
newWindow.document.write("<" + "My Data" + "/>");// Here I want to pass the background data
//That data comes from Excel sheet
}
JavaScript用于客户端,SQL数据库被视为服务器端。为了检索那些数据,你需要一种服务器端语言。
我使用php(在这里学习! [ ^ ])
现在,第二个问题:如果你想更新已在客户端打开的页面,你可以使用AJAX - 它允许你从中获取数据服务器并将其放在您的页面上而不刷新整个页面。 AJAX是对服务器端php'页面'的javaScript调用的组合,它将数据返回到javaScript调用,然后将其放在页面上。
它是实际上,更容易使用HTML / CSS3 / PHP直接创建页面设置,并在需要的地方包含javaScript。
JavaScript is used client-side and SQL database is considered server side. In order to retrieve that data you need a server-side language.
I use php (learn here![^])
Now, a second question: if you want to update a page already opened on the client you would use AJAX - which allows you to get data from the server and put it on your page without refreshing the whole page. AJAX is a combination of a javaScript call to a server-side php 'page' that returns the data to the javaScript call that then puts it on the page.
It's actually just plain easier to use HTML/CSS3/PHP to create your page setup directly and include javaScript where needed.
这篇关于如何在javascript中添加SQL服务器数据到打开窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文