ASP.net MVC Awesome Grid(在嵌套编辑网格中)

时间:2016-06-09 02:34:10

标签: c# asp.net asp.net-mvc

我无法在嵌套编辑网格中工作。这就是它所做的http://demo.aspnetawesome.com/GridNestingDemo。打开网格线并在网格中编辑。当我逐行复制演示代码时,我的网格在网格外的弹出窗口中打开。我一遍又一遍地看着演示项目,几乎完全复制了所有内容。

查看 -

@Html.InitCrudForGridNest("LeadGrid", "Leads")

<div class="bar">
    <button type="button" onclick="utils.nestCreate('LeadGrid', 'createLeadGrid')" class="awe-btn mbtn">Create</button>
</div>



@(Html.Awe().Grid("LeadGrid")
      //.Mod(o => o.PageInfo().InlineEdit(Url.Action("Edit"), Url.Action("Edit")))
      .Url(Url.Action("GetLeadList", "Leads"))
      .Height(0)
      .PageSize(25)
         .Nests(
                new Nest { ButtonClass = "editnst", GetFunc = "utils.loadNestPopup('editLeadGrid')" })
      .Columns(
            new Column { Bind = "Id", Width = 50 },
            new Column() { Bind = "Assigned To" },
            new Column() { Bind = "LeadStatusId" },
            new Column() { Bind = "CreatedOn", ClientFormatFunc = "FormatDateTime" },
            new Column() { Bind = "CustomerName" },
            new Column() { Bind = "CustomerEmail" },
            new Column() { Bind = "CustomerPhone" },
            new Column() { Bind = "TyreId" },
            new Column() { ClientFormat = GridUtils.EditGridNestFormat(), Width = 50 }
      )

控制器 -

public ActionResult GetLeadList(GridParams g,string search)         {             g.PageSize = 25;             //g.Page = 1;             g.Paging = true;

        var leadResult = GetLeads(new LeadSearchCriteriaDto { Page = g.Page, PageSize = 25 });

        var items = AutoMapper.Mapper.Map<IList<Lead>, IList<LeadViewModel>>(leadResult.Data).AsQueryable();

        return Json(new GridModelBuilder<LeadViewModel>(items, g)
        {
            Key = "Id",
            GetItem = () => items.SingleOrDefault(x => x.Id == Convert.ToInt32(g.Key)),
            Map = MapToGridModel,
            ItemsCount = leadResult.ResultCount,
            PageCount = leadResult.ResultCount / 25,


        }.Build());

    }ss

我还将演示项目中的所有javascript css和其他相关文件复制到我的项目中,看看它是否仍然没有区别。我已经逐行调试了javascript和我看到的唯一区别是代码深入它似乎去了一个不同的函数,但它在jquery代码中不确定为什么和我有相同版本的jquery所以它应该是相同的。我真的很茫然。

1 个答案:

答案 0 :(得分:0)

我在任何文档中都没有看到这一点,但您需要在此代码中找到布局页面:

var isMobileOrTablet = '@MobileUtils.IsMobileOrTablet()' == "True";
var dateFormat = '@AweUtil.ConvertTojQueryDateFormat(Thread.CurrentThread.CurrentCulture.DateTimeFormat.ShortDatePattern)';
var decimalSep = '@Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator';

awem.isMobileOrTablet = function () { return isMobileOrTablet; };
utils.init(dateFormat, isMobileOrTablet, decimalSep)