如何在nopcommerce 4.4的datatable ColumnProperty中设置enum



我想在nopcommerce 4.4的datatable ColumnProperty中设置enum。

我试过之类的东西

new ColumnProperty(nameof(await(((TransmitEnumStatus)Model.StatusId).ToSelectListAsync())))
{
Title = T("Admin.Catalog.TransmitProduct.Fields.DriverNo").Text
},

但没有成功。

枚举是否已应用于nopcommerce数据表列属性?如果是,那么以哪种形式?

或者我如何在datatable列属性中实现enum。

您可以查看src/Presentation/Nop.Web/Areas/Admin/Views/Log/List.cshtml文件,了解Enum列的示例用法:

new ColumnProperty(nameof(LogModel.LogLevel))
{
Title = T("Admin.System.Log.Fields.LogLevel").Text,
Width = "100"
},

此外,src/Presentation/Nop.Web.Framework/Models/DataTables/ColumnProperty.cs文件有一个引用:

/// <summary>
/// Set the data source for the column from the rows data object / array.
/// See also "https://datatables.net/reference/option/columns.data"
/// </summary>
public string Data { get; set; }

根据您的需要,您还可以使用.cshtml文件中的Render属性,并将其设置为javascript函数,以向用户呈现所需的html:(如果您在cshtml文件中搜索Render,则会出现不同的示例(

Render = new RenderCustom("render_function_name")
// render_function_name should be a javascript function present in the same cshtml file

最新更新