I am filtering a second datatable based off a selected row of the first database. However, if there is nothing selected on the first datatable, I would like the second datatable to show all records. Is this possible? Currently, if unselected I am settting it to -1.
ajax: {
url: '/api/Contacts',
type: 'post',
data: function (d) {
var selected = applicationtable.row({ selected: true });
if (selected.any()) {
d['Contacts.ApplicationID'] = selected.data().ApplicationID;
} else {
d['Contacts.ApplicationID'] = -1;
}
}
},
it doesn't like the orWhere because it is expecting a fieldname
.Where(q =>
{
q.Where(r =>
{
r.Where("Contacts.ApplicationID", request.Form["Contacts.ApplicationID"]);
r.OrWhere(request.Form["Contacts.ApplicationID"],"-1");
});
})