Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82012

bDeferRender and fnRowCallback

$
0
0
I have a table that assigns colors to cells based on the content. It works well without bDeferRender, but with bDeferRender when the table is sorted on that column the coloring is lost. Without bDeferRender the table is much slower to load in IE. Any suggestions?

	var oTable = $('.dataTable').dataTable({
			"sAjaxSource": '../include/intage_ajax.html',
			"bJQueryUI": true,
			"sDom": '<lf>rt<"F"ip<"clear">T>',
			"bDeferRender": true,
			"sScrollY": '550px',
			"sPaginationType": "full_numbers",
			"bScrollCollapse": true,
			"oTableTools": $.planning.oTableTools,
			"iDisplayLength": 25,
		       "fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
				var count = aData[2];
				var class_name = 'green-bg';
				if (count > 150) {
					class_name = 'red-bg';
				} else if (count > 90) {
					class_name = 'yellow-bg';
				}
				// Remove column sorting background color.
				$('td:eq(2)', nRow).removeClass('sorting_1');
				$('td:eq(2)', nRow).removeClass('sorting_2');
				$('td:eq(2)', nRow).removeClass('sorting_3');
				$('td:eq(2)', nRow).addClass(class_name);	
				return nRow;				
			}
         });

Viewing all articles
Browse latest Browse all 82012

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>