0

我想知道是否可以使用 devexpress 元素制作局部视图以在 Extjs 面板中正常工作。到目前为止,我设法将partialview加载到Extjs面板中。所有devexpress控件都以正确的方式呈现,但是似乎devexpress的整个客户端功能都消失了-悬停,单击等没有反应。这是我的代码

  //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()

有什么办法让它工作吗?这是我的应用程序 http://www.sendspace.pl/file/591cd7a07e43f15a22759b2

4

1 回答 1

0

使用 ExtJScontentEl属性,您可以在面板中包含任何内容。

//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 网格的大小。您可以通过在面板上设置一个带有 DevEx 控件的侦听器来实现此目的。

listeners: {
    resize: function () {
        adjustGridSize(this, DevExGrid);
    }
}

当您与 DevEx 控件交互时,它也会调整大小,这就是为什么您需要指定一个名为EndCallBack.

调整大小函数的实现如下所示:

function endSizeGrid(sender) {
        var el = Ext.get("gridContainer");
        adjustGridSize(el, sender);
};
function adjustGridSize(aGridPnl, aGridView) {
    aGridView.SetHeight(aGridPnl.getHeight());
    aGridView.SetWidth(aGridPnl.getWidth());
};

我希望这会对某人有所帮助。

于 2012-09-28T12:57:33.950 回答