1

I'm having trouble getting the in nest editing grid to work. This it what it is suppose to do http://demo.aspnetawesome.com/GridNestingDemo. Open the grid line to you and edit in the grid. When I copy the demo code pretty much line by line my grid opens up in a popup window outside of the grid. I have looked at the demo project over and over and pretty much copied everything exactly.

View:

@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 }
      )

Controller:

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

    }

I have also copied all the javascript css and other related files from the demo project into my project to see if it was the issue still made no difference. I have debugged line by line the javascript and the only differences I see is deep in the code it seems to go to a different function but its in jquery code not sure why and I have the same version of jquery so it should be the same. I'm really at a loss.

Omu
  • 69,856
  • 92
  • 277
  • 407
Daniel
  • 171
  • 7

1 Answers1

1

I didn't see this in any of there documentation but you need to at this code to the layout page:

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)

;

Daniel
  • 171
  • 7
  • this code is generated by the `@Html.Awe().Init()`, mentioned in the installation steps here: https://www.aspnetawesome.com/learn/mvc/Installation – Omu Sep 18 '20 at 12:28