2016-06-09 149 views
0

我無法在嵌套編輯網格中工作。這就是它應該做什麼http://demo.aspnetawesome.com/GridNestingDemo。打開網格線並在網格中編輯。當我逐行復制演示代碼時,我的網格會在網格外的彈出窗口中打開。我一遍又一遍地看了演示項目,幾乎完全複製了一切。ASP.net MVC Awesome Grid(嵌套編輯網格)

視圖 -

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

控制器 -

公共的ActionResult GetLeadList(GridParams克,字符串搜索) { 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,所以它應該是相同的。我真的很茫然。

回答

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) 

;