【问题标题】:ASP.net MVC Awesome Grid (In nest editing grid)ASP.net MVC Awesome Grid(在嵌套编辑网格中)
【发布时间】:2020-09-18 20:30:41
【问题描述】:

我无法让嵌套编辑网格正常工作。这就是它应该做的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,所以它应该是一样的。我真的很茫然。

【问题讨论】:

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


    【解决方案1】:

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

    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)
    

    ;

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-12-08
    • 1970-01-01
    • 2018-02-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多