Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added fn reload ajax plugin

Signed-off-by: Sakchai Siripanyawuth <sakchai@artellectual.com>
  • Loading branch information...
commit 1a3d2e899fafa76bb44d51f3c9f5616ca8a81443 1 parent 4497d5f
@zacksiri zacksiri authored
View
41 vendor/assets/javascripts/jquery.datatables.fnReloadAjax.js
@@ -0,0 +1,41 @@
+$.fn.dataTableExt.oApi.fnReloadAjax = function ( oSettings, sNewSource, fnCallback, bStandingRedraw )
+{
+ if ( typeof sNewSource != 'undefined' && sNewSource != null )
+ {
+ oSettings.sAjaxSource = sNewSource;
+ }
+ this.oApi._fnProcessingDisplay( oSettings, true );
+ var that = this;
+ var iStart = oSettings._iDisplayStart;
+
+ oSettings.fnServerData( oSettings.sAjaxSource, [], function(json) {
+ /* Clear the old information from the table */
+ that.oApi._fnClearTable( oSettings );
+
+ /* Got the data - add it to the table */
+ var aData = (oSettings.sAjaxDataProp !== "") ?
+ that.oApi._fnGetObjectDataFn( oSettings.sAjaxDataProp )( json ) : json;
+
+ for ( var i=0 ; i<json.aaData.length ; i++ )
+ {
+ that.oApi._fnAddData( oSettings, json.aaData[i] );
+ }
+
+ oSettings.aiDisplay = oSettings.aiDisplayMaster.slice();
+ that.fnDraw();
+
+ if ( typeof bStandingRedraw != 'undefined' && bStandingRedraw === true )
+ {
+ oSettings._iDisplayStart = iStart;
+ that.fnDraw( false );
+ }
+
+ that.oApi._fnProcessingDisplay( oSettings, false );
+
+ /* Callback user function - for event handlers etc */
+ if ( typeof fnCallback == 'function' && fnCallback != null )
+ {
+ fnCallback( oSettings );
+ }
+ }, oSettings );
+}
View
1  vendor/assets/javascripts/simple_datatables.js.coffee
@@ -1,5 +1,6 @@
//= require jquery.dataTables
//= require jquery.datatables.fnSetFilteringDelay
+//= require jquery.datatables.fnReloadAjax
root = exports ? this
Please sign in to comment.
Something went wrong with that request. Please try again.