AlexanderKrutov / DataTables.Queryable

.Net library for clever processing of requests from datatables.net jQuery plugin on the server side (ASP.NET, Nancy or any other web server).
MIT License
51 stars 19 forks source link

ToNameValueCollection() throws when a column is provided but a search is not. #31

Closed VictorioBerra closed 6 years ago

VictorioBerra commented 6 years ago

If you use the DataTablesAjaxPostModel the ToNameValueCollection forces you to provide a search object, even if you just want to order and not search.

VictorioBerra commented 6 years ago

The fix should be to add some null checks.

model[$"columns[{i}][search][value]"] = Columns[i].Search?.Value;
model[$"columns[{i}][search][regex]"] = Columns[i].Search?.Regex.ToString();
AlexanderKrutov commented 6 years ago

Thank you! The fix is included in 1.7.2.