ekondur / DatatableJS

Jquery datatable with entity framework using MVC html helper
MIT License
36 stars 15 forks source link

Error When Set Selecting(true, SelectItems.Checkbox) #140

Closed nazerulgit closed 2 weeks ago

nazerulgit commented 1 month ago

this error is showing up when i set selecting to Selecting(true, SelectItems.Checkbox)

System.ArgumentNullException: Value cannot be null. (Parameter 'name') at System.Type.GetProperty(String name, BindingFlags bindingAttr)

this is my complete view code

@(Html.JS().Datatable<Person>()
.Class("table table-hovered table-striped dataTable")
.Name("datatable")
.LengthMenu(new int[] { 5, 10, 25, 50, 100 }, true, "All Pages")
.FixedColumns(leftColumns: 0, rightColumns: 1)

.ColumnSearching(true, "form-control", SearchPosition.Header)
.Columns(cols =>
{
cols.Field(a => a.PerId).Title("Id");
cols.Field(a => a.PerName).Title("Name");
cols.Field(a => a.PerAddr1).Title("House No");
cols.Field(a => a.PerAddr2).Title("Street Name");
cols.Field(a => a.PerAddr3).Title("Unit");
cols.Field(a => a.PerTelMobile).Title("Mobile");
cols.Field(a => a.category).Title("Category");
cols.Field(a => a.PerEmail).Title("Email");
})
.ColReorder(true)
.Orders(order =>
{
order.Add(p => p.PerId, OrderBy.Descending);
})
.URL(Url.Action("GetDataResultPeople"), "POST")
.ServerSide(true)
.StateSave(true)
.Selecting(true, SelectItems.Checkbox)
.Render()
)

when i check the html created i realized that variable name in column defined datatable is ''

    <html>
columns: [{ --   | data: '',   | name: '',   | defaultContent: '',   | orderable: false,   | searchable: false,   | className: 'select-checkbox',   | visible: true,   | width: '5%',   |     | }, {

thank you

Nasrul Regards

ekondur commented 1 month ago

Hi @nazerulgit Is your package up to date?

nazerulgit commented 1 month ago

Hi @ekondur yes my package is up to date i use version 3.9.0 for DatatableJS and use version 3.8.0 for DatatableJS.Data

ekondur commented 2 weeks ago

Hi @nazerulgit It was fixed and released with v3.9.1

nazerulgit commented 2 weeks ago

hi @ekondur yes thank you so much its working now