Speical headline rows
Speical headline rows
Hi, I am using this great framework to build a movie critic list, there are reviews from all diffrent sources and the the average of the movie.
when displayed i want automatic rows to be added above certain rows for examples, all movies getting up to 3 points, there will be a headline header added above them saying "category A" all movie from 3-5 points "category B" and so on...
anyone has an idea?? please help :)
when displayed i want automatic rows to be added above certain rows for examples, all movies getting up to 3 points, there will be a headline header added above them saying "category A" all movie from 3-5 points "category B" and so on...
anyone has an idea?? please help :)
This discussion has been closed.
Replies
it's quite flexible fw to work with so:
in fnDrawback
[code]
var nTrs = $('#critic tbody tr');
var iColspan = nTrs[0].getElementsByTagName('td').length;
var sLastGroup = 'null';
for (var i = 0 ; i < nTrs.length ; i++) {
var iDisplayIndex = oSettings._iDisplayStart + i;
var sGroup = oSettings.aoData[oSettings.aiDisplay[iDisplayIndex]]._aData[0];
var avg = oSettings.aoData[oSettings.aiDisplay[iDisplayIndex]]._aData.gsx$average.$t;
/*console.log(avg);
console.log(sLastGroup);
console.log('-------------');*/
//console.log(sGroup);
if ((avg >= 0) && (avg < 2.5) && (sLastGroup != '2')) {
console.log("איום ונורא");
var nGroup = document.createElement('tr');
var nCell = document.createElement('td');
nCell.colSpan = iColspan;
nCell.className = "group";
nCell.innerHTML = "שלא תעזו לצאת מהבית";
nGroup.appendChild(nCell);
nTrs[i].parentNode.insertBefore(nGroup, nTrs[i]);
sLastGroup = '2';
}
if ((avg >= 3) && (avg < 3.5) && (sLastGroup != '3')) {
console.log("איום ונורא");
var nGroup = document.createElement('tr');
var nCell = document.createElement('td');
nCell.colSpan = iColspan;
nCell.className = "group";
nCell.innerHTML = "איום ונורא";
nGroup.appendChild(nCell);
nTrs[i].parentNode.insertBefore(nGroup, nTrs[i]);
sLastGroup = '3';
}
if ((avg >= 4) && (avg < 4.5) && (sLastGroup != '4')) {
var nGroup = document.createElement('tr');
var nCell = document.createElement('td');
nCell.colSpan = iColspan;
nCell.className = "group";
nCell.innerHTML = "בסדר";
nGroup.appendChild(nCell);
nTrs[i].parentNode.insertBefore(nGroup, nTrs[i]);
sLastGroup = '4';
}
if ((avg >= 5) && (avg < 5.5) && (sLastGroup != '5')) {
var nGroup = document.createElement('tr');
var nCell = document.createElement('td');
nCell.colSpan = iColspan;
nCell.className = "group";
nCell.innerHTML = "מצויין";
nGroup.appendChild(nCell);
nTrs[i].parentNode.insertBefore(nGroup, nTrs[i]);
sLastGroup = '5';
}
}
},
[/code]