@model DataTablesModel @functions { string GetUrl(DataUrl dataUrl) { return !string.IsNullOrEmpty(dataUrl?.ActionName) && !string.IsNullOrEmpty(dataUrl.ControllerName) ? Url.Action(dataUrl.ActionName, dataUrl.ControllerName, dataUrl.RouteValues) : !string.IsNullOrEmpty(dataUrl.Url) ? $"{(dataUrl.Url.StartsWith("~/", StringComparison.Ordinal) ? Url.Content(dataUrl.Url) : dataUrl.Url).TrimEnd('/')}" + (!dataUrl.TrimEnd ? "/" : "") : string.Empty; } string ReplaceName(string str) { return str.Replace("-", "_"); } void GetAllModels(DataTablesModel model, List models) { models.Add(model); if (!string.IsNullOrEmpty(model.ChildTable?.Name)) { GetAllModels(model.ChildTable, models); } } } @if (Model.FooterColumns > 0) { //You need to add the footer before you create the table //as DataTables doesn't provide a method for creating a footer at the moment @for (int i = 0; i < Model.FooterColumns; i++) { } }
@{ //check using MasterCheckBox var isMasterCheckBoxUsed = Model.ColumnCollection.Any(x => x.IsMasterCheckBox); var listOfTables = new List(); GetAllModels(Model, listOfTables); } @if ((Model.UrlDelete != null) || (Model.ChildTable?.UrlDelete != null)) { foreach (var curModel in listOfTables) { var tableName = ReplaceName(curModel.Name); } } @if (Model.UrlUpdate != null || Model.ChildTable?.UrlUpdate != null) { var currentCulture = CultureInfo.CurrentCulture.Name; foreach (var curModel in listOfTables) { var tableName = ReplaceName(curModel.Name); } } @if (Model.ChildTable != null) { foreach (var curModel in listOfTables) { var tableName = ReplaceName(curModel.Name); if (curModel.ChildTable != null) { var footerHtml = ""; if (curModel.ChildTable.FooterColumns > 0) { //You need to add the footer before you create the table //as DataTables doesn't provide a method for creating a footer at the moment for (int i = 0; i < curModel.ChildTable.FooterColumns; i++) { footerHtml = string.Concat(footerHtml, ""); } footerHtml = string.Concat("", footerHtml, ""); } } } }