Column just won't sort
Column just won't sort
My table initially has a column that has the same value in every row, which is the string "TBD" without the quotes. Via a jQuery ajax call, I update the value in that column with a valid workweek string; i.e. WW24.2, for every row after the page loads. For the life of me, the column will not sort when I click on the column header. Even if i call fnDraw, the column still is not sorted when I click on the column header.
Any suggestions would be greatly aprpeciated.
Thanks,
Matt
Here is an example table where the column with the class colECD will not sort after I change the value (in each row) via an ajax call to a page web method that returns the updated value:
[code]
Priority
Domain
Product / Item
Type
Project Details
ECD
Product Owner
Product Manager
1 - High
Apps
Dunbar
Project
Project: Dunbar Proliferation
Status Summary: Work with partners and developer to have
the app proliferated.
Project Status: On-Track
TBD
PO: John Doe
PM: Phil Up
2 - Medium
Apps
MyApp
Project
Project: MyApp Proliferation
Status Summary: Work with partners and developer to have
the app proliferated.
Project Status: On-Track
TBD
PO: Joe Smoe
PM: Jane Doe
[/code]
Any suggestions would be greatly aprpeciated.
Thanks,
Matt
Here is an example table where the column with the class colECD will not sort after I change the value (in each row) via an ajax call to a page web method that returns the updated value:
[code]
Priority
Domain
Product / Item
Type
Project Details
ECD
Product Owner
Product Manager
1 - High
Apps
Dunbar
Project
Project: Dunbar Proliferation
Status Summary: Work with partners and developer to have
the app proliferated.
Project Status: On-Track
TBD
PO: John Doe
PM: Phil Up
2 - Medium
Apps
MyApp
Project
Project: MyApp Proliferation
Status Summary: Work with partners and developer to have
the app proliferated.
Project Status: On-Track
TBD
PO: Joe Smoe
PM: Jane Doe
[/code]
This discussion has been closed.
Replies
Allan
I hope others using ASP.NET & jQuery will benefit from this solution.
Here is the JavaScript code that details the use of the fnGetPosition and fnUpdate method calls that are working grand now:
[code]
var isLazyLoading = false;
function LazyLoadMilestones() {
if (!isLazyLoading) {
isLazyLoading = true;
var oTable = $('.InfoTable:first').dataTable();
$('.InfoTable > tbody > tr:visible').each(function () {
var item = $(this).find('.itemMilestones:first');
var id = item.attr('id');
if (item.hasClass('load')) {
item.removeClass('load');
$.ajax({
type: "POST",
url: "ProjectTrackerServices.asmx/FetchMilestones",
data: "{ itemId: ' " + id + " ' }",
async: true,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) {
var ecd;
var html;
if (msg.hasOwnProperty('d'))
html = $.base64Decode(msg.d);
else
html = $.base64Decode(msg);
var ind = html.indexOf('#');
ecd = html.substring(0, ind);
html = html.substring(ind + 1);
$('#' + id).html(html);
var aPos = oTable.fnGetPosition($('#ecd' + id).parent()[0]);
oTable.fnUpdate(ecd, aPos[0], aPos[1]);
$('#ecd' + id).text(ecd);
}
});
}
});
isLazyLoading = false;
}
}
setTimeout(LazyLoadMilestones, 1000);
[/code]
Thanks a million Allan!!!
Allan
p.s. I edited your post to add syntax highlighting - hope you don't mind. I'll get around to adding formatting instructions for how to code that to the new forum shortly! :-)