'How to set enum in datatable ColumnProperty of nopcommerce 4.4

I want to set enum in datatable ColumnProperty of nopcommerce 4.4.

I tried things like

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

but didnt work it.

Is enum has applied in nopcommerce datatable column property? if yes then in which form?

Or else how can I implement enum in datatable column property.



Solution 1:[1]

You can take a look at the src/Presentation/Nop.Web/Areas/Admin/Views/Log/List.cshtml file for an example usage of an Enum column:

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

Also, the src/Presentation/Nop.Web.Framework/Models/DataTables/ColumnProperty.cs file has a reference:

        /// <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; }

According to your needs, you might also use the Render property in the .cshtml file and set it to a javascript function to render your desired html to the user: (there are different examples present if you search for Render in cshtml files)

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 UNOPARATOR