I have a list binded to angridview and i want to be able to create filter Where clause 'on the fly',
while the combination of filter option controlled by user.
What is the best way to filter the original list by model boolean property and allow to toggle every condition of filter?
I know that the filterdList is not nececery, but every other solution i've already saw doesn't allow toggle the condition of Where clause.
public partial class Form1 : Form
{
List<dummy> Origlist = new List<dummy> {
new dummy { pk = 1 , istype1 = true, istype2 = false, istype3=false, istype4=false },
new dummy { pk = 2 , istype1 = true, istype2 = false, istype3=false, istype4=false },
new dummy { pk = 3 , istype1 = false, istype2 = true, istype3=false, istype4=false },
new dummy { pk = 4 , istype1 = false, istype2 = true, istype3=false, istype4=false },
new dummy { pk = 5 , istype1 = false, istype2 = false, istype3=true, istype4=false },
new dummy { pk = 6 , istype1 = false, istype2 = false, istype3=true, istype4=false },
new dummy { pk = 7 , istype1 = false, istype2 = false, istype3=false, istype4=true },
new dummy { pk = 8 , istype1 = false, istype2 = false, istype3=false, istype4=true },
new dummy { pk = 9 , istype1 = false, istype2 = false, istype3=true, istype4=false },
new dummy { pk = 10 , istype1 = false, istype2 = true, istype3=false, istype4=false },
new dummy { pk = 11 , istype1 = false, istype2 = false, istype3=false, istype4=false }
};
List<dummy> filteredList = new List<dummy>();
public Form1()
{
InitializeComponent();
}
private void Bind()
{
dataGridView1.DataSource = null;
dataGridView1.DataSource = filteredList;
}
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
if (checkBox1.Checked)
{
filteredList.AddRange(Origlist.Where(a => a.istype1 == true).ToList());
}
else
{
filteredList.RemoveAll(a => a.istype1 == true);
}
Bind();
}
private void checkBox2_CheckedChanged(object sender, EventArgs e)
{
if (checkBox2.Checked)
{
filteredList.AddRange(Origlist.Where(a => a.istype2 == true).ToList());
}
else
{
filteredList.RemoveAll(a => a.istype2 == true);
}
Bind();
}
private void checkBox3_CheckedChanged(object sender, EventArgs e)
{
if (checkBox3.Checked)
{
filteredList.AddRange(Origlist.Where(a => a.istype3 == true).ToList());
}
else
{
filteredList.RemoveAll(a => a.istype3 == true);
}
Bind();
}
private void checkBox4_CheckedChanged(object sender, EventArgs e)
{
if (checkBox4.Checked)
{
filteredList.AddRange(Origlist.Where(a => a.istype4 == true).ToList());
}
else
{
filteredList.RemoveAll(a => a.istype4 == true);
}
Bind();
}
}
Try something like this (untested):
public partial class Form1 : Form
{
List<dummy> Origlist = new List<dummy> {
new dummy { pk = 1 , istype1 = true, istype2 = false, istype3=false, istype4=false },
new dummy { pk = 2 , istype1 = true, istype2 = false, istype3=false, istype4=false },
new dummy { pk = 3 , istype1 = false, istype2 = true, istype3=false, istype4=false },
new dummy { pk = 4 , istype1 = false, istype2 = true, istype3=false, istype4=false },
new dummy { pk = 5 , istype1 = false, istype2 = false, istype3=true, istype4=false },
new dummy { pk = 6 , istype1 = false, istype2 = false, istype3=true, istype4=false },
new dummy { pk = 7 , istype1 = false, istype2 = false, istype3=false, istype4=true },
new dummy { pk = 8 , istype1 = false, istype2 = false, istype3=false, istype4=true },
new dummy { pk = 9 , istype1 = false, istype2 = false, istype3=true, istype4=false },
new dummy { pk = 10 , istype1 = false, istype2 = true, istype3=false, istype4=false },
new dummy { pk = 11 , istype1 = false, istype2 = false, istype3=false, istype4=false }
};
Options options = new Options();
private class Options {
public bool istype1 { get; set; }
public bool istype2 { get; set; }
public bool istype3 { get; set; }
public bool istype4 { get; set; }
}
public Form1()
{
InitializeComponent();
}
private void Bind()
{
dataGridView1.DataSource = null;
dataGridView1.DataSource = OrigList.Where(a =>
(options.istype1 && a.istype1) ||
(options.istype2 && a.istype2) ||
(options.istype3 && a.istype3) ||
(options.istype4 && a.istype4)
).ToList();
}
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
options.istype1 = checkBox1.checked;
Bind();
}
private void checkBox2_CheckedChanged(object sender, EventArgs e)
{
options.istype2 = checkBox2.checked;
Bind();
}
private void checkBox3_CheckedChanged(object sender, EventArgs e)
{
options.istype3 = checkBox3.checked;
Bind();
}
private void checkBox4_CheckedChanged(object sender, EventArgs e)
{
options.istype4 = checkBox4.checked;
Bind();
}
}
There are other ways you could reduce duplication, but this is a start.
I would say that the easiest/cleanest way is using ADO.NET DataSet for handling your data instead of a using a bunch of List with some Linq query. ADO.NET DataSet is the Official Winforms Way of life.
You could use these dataset/datatable with a BindingSource component as the DataSource of your DataGridView and use the Filter String Property of the BindingSource. This String expression could be easily build by some If clauses testing the state of your CheckBox and String concatenation following the MSND DataColumn Expression syntax.
There are some other clean way like extending the BindingList class with a partial implementation of the IBindingListView interface. But that's some pretty hard stuff, specially when you know that Microsoft has done this work for you for the DataSet... This article is a good place to start if you are not afraid.
a single event handler can be reused for every CheckBox, and that event handler can compare every property with respective CheckBox.
List<dummy> Origlist = new List<dummy>
{
new dummy { pk = 1 , istype1 = true, istype2 = false, istype3=false, istype4=false },
new dummy { pk = 2 , istype1 = true, istype2 = false, istype3=false, istype4=false },
new dummy { pk = 3 , istype1 = false, istype2 = true, istype3=false, istype4=false },
new dummy { pk = 4 , istype1 = false, istype2 = true, istype3=false, istype4=false },
new dummy { pk = 5 , istype1 = false, istype2 = false, istype3=true, istype4=false },
new dummy { pk = 6 , istype1 = false, istype2 = false, istype3=true, istype4=false },
new dummy { pk = 7 , istype1 = false, istype2 = false, istype3=false, istype4=true },
new dummy { pk = 8 , istype1 = false, istype2 = false, istype3=false, istype4=true },
new dummy { pk = 9 , istype1 = false, istype2 = false, istype3=true, istype4=false },
new dummy { pk = 10 , istype1 = false, istype2 = true, istype3=false, istype4=false },
new dummy { pk = 11 , istype1 = false, istype2 = false, istype3=false, istype4=false }
};
public Form1()
{
InitializeComponent();
}
private void checkBox_CheckedChanged(object sender, EventArgs e)
{
dataGridView1.DataSource = Origlist.Where(a =>
a.istype1 == checkBox1.Checked &&
a.istype2 == checkBox2.Checked &&
a.istype3 == checkBox3.Checked &&
a.istype4 == checkBox4.Checked).ToList();
}
Related
I am trying to map a nested object from MongoDB (CosmosDB) to Azure Search Indexer.
First, here is what I have stored in MongoDB.
{
"_id" : {
"$binary" : "eHemgNj2FkWlqECKkGKnJA==",
"$type" : "03"
},
"UpdatedBy" : {
"_id" : {
"$binary" : "0wtu6BgDm0GrTbffr1EmhQ==",
"$type" : "03"
},
"Email" : "canuserview#gmail.com"
},
"Status" : "New",
"Name" : "123",
"CustomerName" : ""
}
Then, I have c# program using Microsoft.Azure.Search.Models nuget package to create an index programatically.
private async Task StartIndexAsync(bool resetIndexer = true)
{
await CreateIndexAsync(new[]{
new Field(nameof(ProjectSearchModel.Id), DataType.String) { IsKey = true, IsSearchable = false, IsFilterable = false, IsSortable = false, IsFacetable = false, IsRetrievable = true},
new Field(nameof(ProjectSearchModel.Name), DataType.String) { IsKey = false, IsSearchable = true, IsFilterable = true, IsSortable = true, IsFacetable = false, IsRetrievable = true},
new Field(nameof(ProjectSearchModel.CustomerName), DataType.String) { IsKey = false, IsSearchable = true, IsFilterable = true, IsSortable = true, IsFacetable = false, IsRetrievable = true},
Field.NewComplex(nameof(ProjectSearchModel.UpdatedBy), false, new [] {
new Field(nameof(ProjectSearchModel.UpdatedBy.Id), DataType.String) { IsKey = false, IsSearchable = false, IsFilterable = false, IsSortable = false, IsFacetable = false, IsRetrievable = true},
new Field(nameof(ProjectSearchModel.UpdatedBy.Email), DataType.String) { IsKey = false, IsSearchable = true, IsFilterable = true, IsSortable = true, IsFacetable = false, IsRetrievable = true}
})
},
new[] {
nameof(ProjectSearchModel.Name),
nameof(ProjectSearchModel.Number),
nameof(ProjectSearchModel.CustomerName),
$"{nameof(ProjectSearchModel.UpdatedBy)}/{nameof(ProjectSearchModel.UpdatedBy.Email)}"
});
await CreateDatasourceAsync();
await StartIndexerAsync(resetIndexer);
}
Then, for indexer, I have defined some FieldMappings because I wanted to map _id in MongoDB to Id field in Indexer.
public async Task CreateIndexerAsync(string indexerName, string datasourceName, string indexName)
{
_logger.LogInformation("{0}", "Creating Indexer and syncing data...\n");
var indexer =
new Indexer()
{
Name = indexerName,
Description = "Data indexer",
DataSourceName = datasourceName,
TargetIndexName = indexName,
FieldMappings = new List<FieldMapping> { new FieldMapping() { SourceFieldName = "doc_id", TargetFieldName = "Id" } }
};
try
{
await _searchClient.Indexers.CreateOrUpdateAsync(indexer);
}
catch (Exception ex)
{
_logger.LogError("Error creating and running indexer: {0}", ex.Message);
return;
}
await StartCreation(indexerName);
}
Now, _id from MongoDB is correctly mapped to Id field in Indexer from the code above.
{
"#odata.context": "myprojectendpoint/indexes('myproject-index-dev')/$metadata#docs(*)",
"value": [
{
"#search.score": 1,
"Id": "30dbf04d-cbc7-4597-8d48-209f3a320cf8",
"Name": "friday soon",
"CustomerName": "Kyle Ahn",
"UpdatedBy": {
"Id": null,
"Email": "kyle.ahn#onthestep.ca"
}
}
]
}
I would like to do the same for Id sub-field inside UpdatedBy field. So, I would like to map UpdatedBy._id in MongoDB to UpdatedBy/Id in index.
Is there a way to achieve this?
Huge thanks to everyone in advance!
This is not supported by Azure search indexers. When adding field mappings, your target should be a top-level index field. This means, you can possibly map one complex object from your data source as a whole to a complex field in the index - but you cannot map one sub-field from a complex object in the source to a "child" of a complex field in your index.
Point #2 in the field mappings document states this, but I'll update it to be clearer.
As a work around, you could either try to modify the "UpdatedBy" property to have sub-fields that align with the index definition; or you could try to modify the sub-field directly using the SDK, using something like the following (I am assuming a name for your index data model)
IndexAction.MergeOrUpload(
new Customer()
{
Id = "....",
UpdatedBy = new
{
Id = "..."
}
}
)
This will "merge" (add) the missing Id property from your MongoDb into your search index - note that this only works because your "UpdatedBy" complex field is not a collection.
I am currently performing a SuiteTalk search via C# that joins multiple tables, one of which is for Sales Orders. When performing a typical GET on a SalesOrder record, the property customFieldList gets populated with an array of transaction custom fields/etc. I am curious how to get the same when doing a search like:
SearchResult searchResult = Client.Service.search(new TransactionSearchAdvanced()
{
criteria = new TransactionSearch()
{
basic = new TransactionSearchBasic()
{
type = new SearchEnumMultiSelectField()
{
#operator = SearchEnumMultiSelectFieldOperator.anyOf,
operatorSpecified = true,
searchValue = new String[] { "_salesOrder" },
},
lastModifiedDate = new SearchDateField()
{
#operator = SearchDateFieldOperator.after,
operatorSpecified = true,
searchValue = fromLastModifiedDateTime.ToUniversalTime(),
searchValueSpecified = true
}
},
},
columns = new TransactionSearchRow()
{
basic = new TransactionSearchRowBasic()
{
internalId = new SearchColumnSelectField[] { new SearchColumnSelectField() },
tranId = new SearchColumnStringField[] { new SearchColumnStringField() },
tranDate = new SearchColumnDateField[] { new SearchColumnDateField() },
dateCreated = new SearchColumnDateField[] { new SearchColumnDateField() },
item = new SearchColumnSelectField[] { new SearchColumnSelectField() },
quantity = new SearchColumnDoubleField[] { new SearchColumnDoubleField() },
lastModifiedDate = new SearchColumnDateField[] { new SearchColumnDateField() },
email = new SearchColumnStringField[] { new SearchColumnStringField() },
//customFieldList = new SearchColumnCustomField[] { },
},
itemJoin = new ItemSearchRowBasic()
{
itemId = new SearchColumnStringField[] { new SearchColumnStringField() },
type = new SearchColumnEnumSelectField[] { new SearchColumnEnumSelectField() },
},
customerJoin = new CustomerSearchRowBasic()
{
internalId = new SearchColumnSelectField[] { new SearchColumnSelectField() },
billAddress = new SearchColumnStringField[] { new SearchColumnStringField() },
companyName = new SearchColumnStringField[] { new SearchColumnStringField() },
phone = new SearchColumnStringField[] { new SearchColumnStringField() },
email = new SearchColumnStringField[] { new SearchColumnStringField() },
},
customSearchJoin = new CustomSearchRowBasic[]
{
},
}
});
The property I want populated is commented out within the TransactionSearchRowBasic object:
//customFieldList = new SearchColumnCustomField[] { },
Any ideas? Thank you in advance!
The search operation doesn't return as much information as a GET operation does on the SuiteTalk Web Services.
For each record that is returned in your SearchResult, use the internalId or document number to GET that record. This should then include your custom fields.
NetSuiteService _service = new NetSuiteService();
ReadResponse res = _service.get(new RecordRef { internalId = internalID, type = RecordType.salesOrder, typeSpecified = true });
By default the View displays a sorted table which is great but cannot Sort the table columns by clicking on the table headers in ascending or descending order. The header column arrows goes up and down on clicks but the data stays the same. I am using jQuery jTable and sorting is enabled by default.
Is is possible to do this by using a jQuery?
Here's my code for your inspection:
View:
$(document).ready(function () {
$('#TopPlayedInVenueContainer1').jtable({
title: 'Top Tracks Played Records',
paging: true,
pageSize: 100,
sorting: true,
defaultSorting: 'Date ASC',
actions: {
listAction: '#Url.Action("TopPlayedInVenueList1")'
},
fields: {
TrackID: {
title: 'Track ID',
key: true,
create: false,
edit: false,
resize: false,
tooltip: 'Track Name',
sorting: true //This column is not sortable!
},
Date: {
title: 'Date',
type: 'date',
displayFormat: 'dd - mm - yy',
tooltip: 'DD - MM - YY',
list: true,
sorting: true //This column is not sortable!
},
TrackName: {
title: 'Track Name',
key: true,
create: false,
edit: false,
resize: false,
tooltip: 'Track Name',
sorting: true //This column is not sortable!
},
ArtistName: {
title: 'Artist Name',
key: true,
create: false,
edit: false,
resize: false,
tooltip: 'Track Name',
sorting: true //This column is not sortable!
},
Times: {
title: 'Times',
tooltip: 'Artist Name',
sorting: false //This column is not sortable!
}
}
});
// All
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
var todayDate = new Date();
var endDate = todayDate.getDate() + '/' + (todayDate.getMonth() + 1) + '/' + (todayDate.getFullYear() + 100);
var d = new Date();
var st = d.setDate(todayDate.getDate() - 111365);
var startDate = d.getDate() + '/' + (d.getMonth() + 1) + '/' + d.getFullYear();
$('#allrecordsstart').val(startDate);
$('#allrecordsend').val(endDate);
$('#TopPlayedInVenueContainer1').jtable('load', {
StartDate: startDate,
EndDate: endDate
});
$('#allrecords').click(function (e) {
e.preventDefault();
var startDate = $('#allrecordsstart').val();
var endDate = $('#allrecordsend').val();
$('#TopPlayedInVenueContainer1').show(0).delay(0).fadeIn(1000).jtable('load', {
StartDate: startDate,
EndDate: endDate
});
});
Controller: Edit for #CHash_Mile.. thanks a lot :) here's the code: EDIT: 15/04/2014
[HttpPost]
public JsonResult TopPlayedInVenueList1(string StartDate = "", string EndDate = "", int jtStartIndex = 0, int jtPageSize = 0, string jtSorting = null)
{
try
{
if (Request.IsAuthenticated == true)
{
string Path = #"C:\\5Newwithdate-1k.xls";
OleDbConnection con = new OleDbConnection(#"Provider=Microsoft.Jet.OLEDB.4.0;Data Source= '" + Path + "';Extended Properties=" + (char)34 + "Excel 8.0;IMEX=1;" + (char)34 + "");
OleDbDataAdapter da = new OleDbDataAdapter("select * from [Sheet1$]", con);
con.Close();
System.Data.DataTable data = new System.Data.DataTable();
da.Fill(data);
List<TopPlayed> daa = new List<TopPlayed>();
foreach (DataRow p in data.Rows)
{
TopPlayed top = new TopPlayed()
{
TrackID = Convert.ToInt32(p.Field<double>("TrackID")),
Date = p.Field<DateTime>("DateTimes"),
TrackName = p.Field<string>("TrackName"),
ArtistName = p.Field<string>("ArtistName"),
Times = Convert.ToInt32(p.Field<double>("Times"))
};
daa.Add(top);
}
var listOrder = daa.Where(i => i.Date >= Convert.ToDateTime(StartDate) && i.Date <= Convert.ToDateTime(EndDate)).ToList();
if (jtStartIndex + 150 > listOrder.ToList().Count)
{
int val = listOrder.ToList().Count - jtStartIndex;
jtPageSize = val;
}
var newlist = listOrder.OrderByDescending(i => i.Times).ToList().GetRange(jtStartIndex, jtPageSize);
if (string.IsNullOrEmpty(jtSorting)) { jtSorting = "Date ASC"; }
SortDirection sortDirection = jtSorting.ToLower().Contains("desc") ? SortDirection.DESC : SortDirection.ASC;
string sortExpression = sortDirection == SortDirection.DESC ? jtSorting.ToLower().Replace(" desc", "") : jtSorting.ToLower().Contains(" asc") ? jtSorting.ToLower().Replace(" desc", "") : jtSorting;
if (sortDirection == SortDirection.ASC)
{
newlist = newlist.OrderBy(item => GetPropertyValue(item, sortExpression)).ToList();
}
else
{
newlist = newlist.OrderByDescending(item => GetPropertyValue(item, sortExpression)).ToList();
}
return Json(new { Result = "OK", Records = newlist, TotalRecordCount = listOrder.ToList().Count });
}
return Json(new { Result = "ERROR" });
}
catch (Exception ex)
{
return Json(new { Result = "ERROR", Message = ex.Message });
}
}
Debugged using Step Over line by line and seems to be this line of the code is the culprit:
newlist = newlist.OrderBy(item => GetPropertyValue(item, sortExpression)).ToList();
Because after this line I get error message on the View in browser:
Object reference not set to an instance of an object.
Images: Edit for #CHash_Mile.. thanks a lot man :) screenshots of the debug:
sortExpression ---------- URL
newList ---------- URL
I'm sorry for taking your time soo much and really appreciate in what you're doing for me!
Check this
Sorting using Jtable example
I see you are not using variable jtSorting for sorting. this gives property with which sorting needs to be done. Try with below code after loading newlist.
SortDirection sortDirection = jtSorting.ToLower().Contains("desc") ? SortDirection.DESC : SortDirection.ASC;
string sortExpression = sortDirection == SortDirection.DESC ? jtSorting.ToLower().Replace(" desc", "") : jtSorting.ToLower().Contains(" asc") ? jtSorting.ToLower().Replace(" desc", "") : jtSorting;
if (sortDirection == SortDirection.ASC)
{
newlist = newlist.OrderBy(item => GetPropertyValue(item, sortExpression))).ToList();
}
else
{
newlist = newlist.OrderByDescending(item => GetPropertyValue(item, sortExpression))).ToList();
}
Add below method -
public static object GetPropertyValue(object obj, string propertyName)
{
return obj == null ? null : obj.GetType().GetProperty(propertyName).GetValue(obj, null);
}
Add below enum inside your class -
internal enum SortDirection
{
ASC,
DESC
}
i'm generating EXT.NET gridview dynamically as below,
public GridPanel GetGridView()
{
return new GridPanel
{
Border = false,
ID = "grd",
Cls = "x-grid-custom",
StyleSpec = "margin-top:7px; margin-left:-2px",
Scroll = ScrollMode.Both,
OverflowX = Overflow.Auto,
EnableColumnHide = false,
ColumnLines = true,
ForceFit = false,
//Width = 1100,
EmptyText = "No rows to display",
Store = { this.CreateTabularStore() },
ColumnModel =
{
Columns = {
new DateColumn {ID="ED", Text = "Effective Date",Wrap = true,DataIndex = "ED",Format="dd MMM yyyy",Groupable = true, Html="<i class='prfl_unfilter_icon' onclick='return ShowGridFilter(this);'></i>" ,Width = 110},
new Column {ID="PRICE", Text = "Price",DataIndex = "PRICE",Groupable = true, Html="<i class='prfl_unfilter_icon' onclick='return ShowGridFilter(this);'></i>" ,Width = 70},
new Column {ID="CURRENCY", Text = "Currency",DataIndex = "CURRENCY",Groupable = true, Html="<i class='prfl_unfilter_icon' onclick='return ShowGridFilter(this);'></i>" ,Width = 80},
new Column {ID="OFFICIAL",Text = "Official Price",DataIndex = "OFFICIAL",Groupable = true, Html="<i class='prfl_unfilter_icon' onclick='return ShowGridFilter(this);'></i>" ,Width = 100},
new DateColumn {ID="MARKETED_EFFECTIVE_DATE", Text = "Marketed Effective Date",DataIndex = "MARKETED_EFFECTIVE_DATE",Format="dd MMM yyyy",Groupable = true, Html="<i class='prfl_unfilter_icon' onclick='return ShowGridFilter(this);'></i>" ,Width = 100},
new Column {ID="MARKETING_DESC", Text = "Marketed",DataIndex = "MARKETING_DESC",Groupable = true, Html="<i class='prfl_unfilter_icon' onclick='return ShowGridFilter(this);'></i>" ,Width = 80},
new DateColumn {ID="DISCONTINUED_TS", Text = "Date Discontinued",DataIndex = "DISCONTINUED_TS",Format="dd MMM yyyy",Groupable = true, Html="<i class='prfl_unfilter_icon' onclick='return ShowGridFilter(this);'></i>" ,Width = 100},
}
},
Features = {
new Grouping(){HideGroupedHeader=false }
},
View = { new Ext.Net.GridView() { LoadMask = true, LoadingText = "Loading..." } }
};
}
below is how i defined store in a method named CreateTabularStore():
Store store;
Model model;
store = new Store();
store.ID = "StorePD";
model = new Model();
model.Fields.AddRange(new ModelField[] {
new ModelField("ED",ModelFieldType.Date),
new ModelField("PRICE", ModelFieldType.Float),
new ModelField("CURRENCY"),
new ModelField("OFFICIAL"),
new ModelField("MARKETED_EFFECTIVE_DATE",ModelFieldType.Date),
new ModelField("MARKETING_STATUS_DESC"),
new ModelField("DISCONTINUED_TS",ModelFieldType.Date)
}
);
when i filter grid with DateColumn filter, grid columns are rendering distorted in IE 8 Browser as shown in the image below
Hi I have a mDataProp DateTime formatting issue. Basically I want to display the date in one column and the time in another.
But as I understand it the mDataProp is directly related to your model, which does not have a time property just a adate......
Controller
var result = from a in data
select new
{
appointmentDate = a.AppointmentDate.ToShortDateString(),//.ToString("g"),
appointmentTime = a.AppointmentDate.ToLocalTime().ToString("t"),
appointmentName = a.AppointmentType.AppName,
appointmentID = a.AppointmentID
};
//Return Json data for Datatable
return Json(new
{
sEcho = param.sEcho,
iTotalRecords = total,
iTotalDisplayRecords = total,
aaData = result
});
View
<script>
$(document).ready(function () {
var urlRequest = $('#apptTable').data("request-url");
var detailRequest = $('#apptTable').data("detail-url");
$('#apptTable').dataTable({
"bSort": false,
"bServerSide": true,
"sAjaxSource": urlRequest,
"sServerMethod": "POST",
"bProcessing": true,
"bFilter": false,
"aoColumns": [
{ "mDataProp": "appointmentDate" },
{ "mDataProp": "appointmentDate" },
{ "mDataProp": "appointmentName" },
{
"mDataProp": "appointmentID",
"fnRender": function (oObj) {
return 'Details';
}
}
]
});
});
</script>
I cannot create a second variable called appointmentDate in the controller, so I'll have to format in the view.
Any ideas?