1

我无法让嵌套编辑网格正常工作。这就是它应该做的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());

    }

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

4

1 回答 1

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)

;

于 2016-06-09T03:48:40.337 回答