Sorting in grid with numeric, text and checkboxes
//code for displaying normal text/numeric values
obj.setCellData(
function(col, row) {
if(data[row][col]==0) {
return '';
}
else {
return data[row][col];
}
});
//code for displaying checkboxes values
obj.setCellValue(
function(col, row) {
//since checkboxes begin with the word 'Allow'
if (columns[col].indexOf('Allow') > -1) {
if (data[row][col]=='T')
return true;
else
return false;
}
//for normal text/numeric values
else {
if(data[row][col]==0) {
return '';
}
else {
return data[row][col];
}
}
});
These are the problems I'm facing:
1. if I don't include obj.setCellValue, then checkboxes don't work correctly, but text and numeric sorting are fine
2. Once I include obj.setCellValue, numeric values are sorted like text e.g 2, 20, 5, 55
Can you tell me how to get sorting with different data types to work correctly.
Thanks.
obj.setCellData(
function(col, row) {
if(data[row][col]==0) {
return '';
}
else {
return data[row][col];
}
});
//code for displaying checkboxes values
obj.setCellValue(
function(col, row) {
//since checkboxes begin with the word 'Allow'
if (columns[col].indexOf('Allow') > -1) {
if (data[row][col]=='T')
return true;
else
return false;
}
//for normal text/numeric values
else {
if(data[row][col]==0) {
return '';
}
else {
return data[row][col];
}
}
});
These are the problems I'm facing:
1. if I don't include obj.setCellValue, then checkboxes don't work correctly, but text and numeric sorting are fine
2. Once I include obj.setCellValue, numeric values are sorted like text e.g 2, 20, 5, 55
Can you tell me how to get sorting with different data types to work correctly.
Thanks.
AI
January 12,