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

fnReloadAjax issue

$
0
0
Hello Allan, I came across a problem with fnReloadAjax.

The problem :

>> When two different computers are on the same page using fnReloadAjax on the same table when some one alters the data for example say when column = 3 instead of 2 the data in the first client that initiated the change is gone (which should work) but in the second client / computer the old data where is still there.

When I say still there, I mean that since the value of column is not 2 any more (it is 3) the data should not be showing in that table, but the second client still has the data shown on the table.

Possible issue (that I can think of?) :

One minute the fnReloadAjax is in fact retrieving the JSON data, but when the JSON data is not present any more (when the column value now equals 3 rather then 2) the data on the second client still shows up on that table (when it shouldn’t').

When I go home tonight I will turn my server on and hopefully you can have a look at it. I will also upload a video and put it on this thread to show you in more detail the issue.

For the mean time my code is :

 
function ajaxcall() {
	$this->load->model('queue_model');

	$data['waiting'] = $this->queue_model->waiting();
	$data['beingseen'] = $this->queue_model->beingseen();

	$this->output->set_header('Content-Type: application/json; charset=utf-8');
	echo json_encode($data);
    }

<script type="text/javascript">
	    $(document).ready(function()
	    {
		var table1 = $('#waiting').dataTable(
			{
			    "sPaginationType": "full_numbers",
			    "bJQueryUI": true,
			    "iDisplayLength": 10,
			    "aLengthMenu": [5, 10],
			    "sAjaxDataProp": "waiting",
			    "sAjaxSource": '<?php echo base_url();?>studentqueue_controller/ajaxcall',
			    "bDeferRender": true,
			    "bAutoWidth": false,
			    "aoColumns":
				    [
					{"mdata": "id",
					    "sWidth": "7%",
					    "mRender": function(data, full)
					    {
						var div = '<div id="waitinglinks">';
						var url = '<a href="<?php echo base_url();?>studentqueue_controller/start/' + data + '" title="Start Session">' + '<img src="<?php echo base_url();?>images/greencheck.gif"' + '</a>';
						var url1 = '<a href="<?php echo base_url();?>studentqueue_controller/stop/' + data + '" title="End Session">' + '<img src="<?php echo base_url();?>images/orangeMinus.png"' + '</a>';
						var url2 = '<a href="<?php echo base_url();?>studentqueue_controller/abandon/' + data + '" title="Abandon Session">' + '<img src="<?php echo base_url();?>images/redX.png"' + '</a>';
						var end = '</div>';

						return div + url + url1 + url2 + end;
					    }
					},
					{
					    "mdata": "anum",
					    "sWidth": "1%",
					    "mRender": function(data, full)
					    {
						return '<a href="<?php echo base_url();?>studenthistory_controller/history/' + data + '" target="_blank">' + data + '</a>';
					    }
					},
					{"mdata": "first"},
					{"mdata": "last"},
					{"mdata": "SECOND",
					    "sWidth": "1%"
					},
					{"mdata": "reason"},
					{"mdata": "studentcomments"},
					{"mdata": "aidyear",
					    "sWidth": "1%"
					},
					{"mdata": "counselorcomments"}
				    ]
			});
		setInterval(function() {
		    table1.fnReloadAjax(null, null, true);
		}, 1000);
	    });
	</script>
	<script type="text/javascript">
	    $(document).ready(function()
	    {
		var table2 = $('#beingseen').dataTable(
			{
			    "sPaginationType": "full_numbers",
			    "bJQueryUI": true,
			    "iDisplayLength": 10,
			    "aLengthMenu": [5, 10],
			    "sAjaxDataProp": "beingseen",
			    "sAjaxSource": '<?php echo base_url();?>studentqueue_controller/ajaxcall',
			    "bDeferRender": true,
			    "bAutoWidth": false,
			    "aoColumns":
				    [
					{"mdata": "id",
					    "sWidth": "1%",
					    "mRender": function(data, full)
					    {
						var div = '<div id="beingseenlinks">';
						var url = '<a href="<?php echo base_url();?>studentqueue_controller/cont/' + data + '" title="Continue Session">' + '<img src="<?php echo base_url();?>images/greencheck.gif"' + '</a>';
						var url1 = '<a href="<?php echo base_url();?>studentqueue_controller/terminate/' + data + '" title="Terminate Session">' + '<img src="<?php echo base_url();?>images/blue_minus.gif"' + '</a>';
						var end = '</div>';

						return div + url + url1 + end;
					    }
					},
					{"mdata": "anum",
					    "sWidth": "1%"
					},
					{"mdata": "first"},
					{"mdata": "last"},
					{"mdata": "signintime",
					    "sWidth": "14%"
					},
					{"mdata": "fname",
					    "sWidth": "1%"
					},
					{"mdata": "starttime",
					    "sWidth": "14%"
					},
					{
					    "mdata": "TIME",
					    "swidth": "10%"
					}
				    ]
			});
		setInterval(function() {
		    table2.fnReloadAjax(null, null, true);
		}, 15000);
	    });
	</script>



Videos will come as soon as possible.

Viewing all articles
Browse latest Browse all 82109

Trending Articles



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