Asp.net mvc 如何将带有devexpress元素的partialview正确加载到extjs面板中
我想知道是否可以使用devexpress元素使partialview在Extjs面板中正常工作。到目前为止,我成功地将partialview加载到Extjs面板中。所有DevXPress控件都以正确的方式呈现,但似乎DevXPress的整个客户端功能都消失了-悬停、单击等操作没有任何反应。这是我的代码Asp.net mvc 如何将带有devexpress元素的partialview正确加载到extjs面板中,asp.net-mvc,extjs4,devexpress,Asp.net Mvc,Extjs4,Devexpress,我想知道是否可以使用devexpress元素使partialview在Extjs面板中正常工作。到目前为止,我成功地将partialview加载到Extjs面板中。所有DevXPress控件都以正确的方式呈现,但似乎DevXPress的整个客户端功能都消失了-悬停、单击等操作没有任何反应。这是我的代码 //loading partialView Ext.getCmp('centerPanel').body.load({ url: 'Home/TempView',scripts:tr
//loading partialView
Ext.getCmp('centerPanel').body.load({ url: 'Home/TempView',scripts:true})
//controller
public class HomeController : Controller
{
//
// GET: /Home/
public ActionResult Index()
{
return View();
}
public PartialViewResult TempView()
{
return PartialView();
}
}
//TempView
<div>
@Html.Partial("ToolBarView");
</div>
//ToolBarView
@using DevExpress.Web.Mvc.UI
@Html.DevExpress().ReportToolbar(settings => {
// The following settings are necessary for a Report Toolbar.
settings.Name = "ReportToolbar";
settings.ReportViewerName = "reportViewer1";
}).GetHtml()
有什么办法使它起作用吗?
这是我的申请表
使用ExtJS contentEl属性,您可以在面板中包含任何内容
//index.cshtml
<div id="dxGrid">
@Html.Partial("GridViewPartialView")
</div>
//GridViewPartialView.cshtml
@Html.DevExpress().GridView(settings =>
{
settings.Name = "DevExGrid";
settings.CallbackRouteValues = new { Controller = "Home", Action = "GridViewPartialView" };
settings.Width = System.Web.UI.WebControls.Unit.Percentage(100);
settings.ClientSideEvents.EndCallback = "function(s, e) { endSizeGrid(s); }";
}).Bind(Model).GetHtml()
//ExtJS code
Ext.create('Ext.panel.Panel', {
contentEl: 'dxGrid',
id: 'gridContainer',
title: 'Devexpress inside ExtJS'
});
当您与DevEx控件交互时,它也会调整大小,这就是为什么您需要指定一个名为EndCallBack的clientsideevent
调整大小功能的实现如下所示:
function endSizeGrid(sender) {
var el = Ext.get("gridContainer");
adjustGridSize(el, sender);
};
function adjustGridSize(aGridPnl, aGridView) {
aGridView.SetHeight(aGridPnl.getHeight());
aGridView.SetWidth(aGridPnl.getWidth());
};
我希望这能帮助别人
function endSizeGrid(sender) {
var el = Ext.get("gridContainer");
adjustGridSize(el, sender);
};
function adjustGridSize(aGridPnl, aGridView) {
aGridView.SetHeight(aGridPnl.getHeight());
aGridView.SetWidth(aGridPnl.getWidth());
};