I am on NOPCommerce 4.50 and I am trying to use Datatables' default search functionality in one of my child datatables in NOPCommerce.
I want to enable search for this table in Specification Attributes;
{
Name = "specificationattributes-grid",
UrlRead = new DataUrl("SpecificationAttributeList", "SpecificationAttribute", null),
IsChildTable = true,
Length = Model.PageSize,
LengthMenu = Model.AvailablePageSizes,
Filters = new List<FilterParameter>
{
new FilterParameter(nameof(SpecificationAttributeModel.SpecificationAttributeGroupId), nameof(SpecificationAttributeGroupModel.Id), true)
},
ColumnCollection = new List<ColumnProperty>
{
new ColumnProperty(nameof(SpecificationAttributeModel.Id))
{
IsMasterCheckBox = true,
Render = new RenderCheckBox("checkbox_specificationattributes"),
ClassName = NopColumnClassDefaults.CenterAll,
Width = "50"
},
new ColumnProperty(nameof(SpecificationAttributeModel.Name))
{
Title = T("Admin.Catalog.Attributes.SpecificationAttributes.SpecificationAttribute.Fields.Name").Text,
Width = "300",
Searchable = true
},
new ColumnProperty(nameof(SpecificationAttributeModel.DisplayOrder))
{
Title = T("Admin.Catalog.Attributes.SpecificationAttributes.SpecificationAttribute.Fields.DisplayOrder").Text,
Width = "150",
ClassName = NopColumnClassDefaults.CenterAll
},
new ColumnProperty(nameof(SpecificationAttributeModel.Id))
{
Title = T("Admin.Common.Edit").Text,
Width = "50",
ClassName = NopColumnClassDefaults.Button,
Render = new RenderButtonEdit(new DataUrl("EditSpecificationAttribute"))
}
}
}
Although I have done Searchable = true in the column that I want to make searchable, the search textbox doesnot seem to appear in the datatable. Datatables' paging functionalities are working fine though.
Can anyone help me out??
You can't enable search option because it's custom ajax Datatable implemented. And new data are loading from system on pagination change. While default datatable js load all data at a time and render in dom and searching data from dom.