Quantcast
Channel: DataTables 1.9 — DataTables forums
Viewing all articles
Browse latest Browse all 1816

Help regarding "Showing entries in Datatable"

$
0
0
Hi,
First of all, I really appreciate the wonderful plugin - Datatable. Great work :) I am new to Datatable and want to control the showing entries of the datatable. In my application, i have to load a large amount of data. In order to cut down the performance overhead, we are doing ajax call on ever y page click ( four_button plugin ) returning 50 records. I have set iTotalRecords (say 3457) , iTotalDisplayRecords (say 50) parameters in aaData in the response. I have gone through the documentation several times to find out the parameter to control them. but, i couldn't find the correct one. iDisplayStart is always at 0. so, on every button (first, next,previous,last) click, the data (50 records) gets loaded successfully. but, it always show (1-50 of 3457 records). Please let me know any pointers / references / examples. Any insight is highly appreciated.

oTable = $('#opportunityData').dataTable

		(
				{ 
					"bServerSide": true,		
				    "iDisplayStart":$("#pagenum").val(),
					"sScrollY" : 425,
					"bFilter" : true,
					"sDom" : 'rt<"bottom"lip><"clear">',
					"bProcessing" : true,
					"bDestroy" : true,
					"sAjaxSource" : appPath + "data/opportunity/search.html",
					
					"fnServerParams" : function(aoData) {

						aoData.push({
							"name" : "resultsql",
							"value" : resultsql
						});
						aoData.push({
							"name" : "jobdept",
							"value" : jobdept
						});
						aoData.push({
							"name" : "edulevel",
							"value" : edulevel
						});
						aoData.push({
							"name" : "explevel",
							"value" : explevel
						});
						aoData.push({
							"name" : "Statedes",
							"value" : statecode
						});
						aoData.push({
							"name" : "currentdistrict",
							"value" : districtcode
						});
						aoData.push({
							"name" : "instname",
							"value" : instName
						});
						aoData.push({
							"name" : "pageno",
							"value" : pageno
						});
						aoData.push({
							"name" : "isSearch",
							"value" : isSearch
						});
					},
					"fnInitComplete" : function() {
						$('.dataTables_scroll').find('.dataTables_scrollBody')
								.niceScroll({

									cursorborder : 'none',

									cursorcolor : "#CCCCCC",
									autohidemode : false

								});
						// custom scroll bars
						// $('.dataTables_scroll').find('.dataTables_scrollBody').mCustomScrollbar({
						//	scrollButtons:{
						//		enable:true
						//	}
						//});
						$('.dataTables_scrollHeadInner').css("width", "100%");
						$('.display').css("width", "100%");
						$("select").addClass("chzn-drop-up");
						// $("select").addClass("chzn-select");

						$(".chzn-drop-up").trigger("liszt:updated");
						$(".chzn-drop-up").chosen1();
						var config = {
							'.chzn-select' : {},
							'.chzn-select-deselect' : {
								allow_single_deselect : true
							},
							'.chzn-select-no-single' : {
								disable_search_threshold : 10
							},
							'.chzn-select-no-results' : {
								no_results_text : 'Oops, nothing found!'
							},
							'.chzn-select-width' : {
								width : "95%"
							}
						}
						for ( var selector in config) {
							$(selector).chosen(config[selector]);
						}

					},

					"sPaginationType" : "four_button",
					"bJQueryUI" : true,
					"aoColumnDefs" : [

					{
						"bSearchable" : true,
						"bVisible" : false,
						"aTargets" : [ 8 ]
					} ],
					//"sDom": 'T<"clear">lfrtip',/*Task ID :  SF00004*/
					"oTableTools" : {/*Task ID :  SF00004*/
						"sSwfPath" : appPath
								+ "resources/js/copy_csv_xls_pdf.swf",
						"aButtons" : [ {
							"sExtends" : "pdf",
							"sButtonText" : "Export as PDF",
							//"sPdfMessage": "22/07/2013",

							"mColumns" : [ 0, 1, 2, 3, 4, 5, 6, 7 ]
						}, {
							"sExtends" : "xls",
							"sButtonText" : "Export to Excel",

							"mColumns" : [ 0, 1, 2, 3, 4, 5, 6, 7 ]
						}, ]
					},
					"oLanguage" : {
						"sSearch" : "Search all columns:",
						"sLoadingRecords" : "Please wait - loading..."
					},
					"bAutoWidth" : false,
					"aoColumns" : [ {
						sWidth : "10%",
						"sClass" : "gridwrap"
					}, {
						sWidth : '10%',
						"sClass" : "gridwrap"
					}, {
						sWidth : '10%',
						"sClass" : "gridwrap"
					}, {
						sWidth : '10%',
						"sClass" : "gridwrap"
					}, {
						sWidth : '10%',
						"sClass" : "gridwrap"
					}, {
						sWidth : '10%',
						"sClass" : "gridwrap"
					}, {
						sWidth : '10%',
						"sClass" : "gridwrap"
					}, {
						sWidth : '10%',
						"sClass" : "gridwrap"
					}, {
						sWidth : '10%',
						"sClass" : "gridwrap"
					}, {
						sWidth : '10%',
						"sClass" : "centeralign"
					}

					]
				});
		//oTable.fnDraw();
		//oTable.fnStandingRedraw();

	}

Viewing all articles
Browse latest Browse all 1816

Trending Articles