nl_tokens: / * response = { current : 1 rowCount : 10 rows : [ {} {} ] sort : [ { columnId : asc } ] total : 101 }
pl_tokens: function loadData ( ) { var that = this ; this . element . _bgBusyAria ( true ) . trigger ( "load" + namespace ) ; showLoading . call ( this ) ; function containsPhrase ( row ) { var column , searchPattern = new RegExp ( that . searchPhrase , ( that . options . caseSensitive ) ? "g" : "gi" ) ; for ( var i = 0 ; i < that . columns . length ; i ++ ) { column = that . columns [ i ] ; if ( column . searchable && column . visible && column . converter . to ( row [ column . id ] ) . search ( searchPattern ) > - 1 ) { return true ; } } return false ; } function update ( rows , total ) { that . currentRows = rows ; setTotals . call ( that , total ) ; if ( ! that . options . keepSelection ) { that . selectedRows = [ ] ; } renderRows . call ( that , rows ) ; renderInfos . call ( that ) ; renderPagination . call ( that ) ; that . element . _bgBusyAria ( false ) . trigger ( "loaded" + namespace ) ; } if ( this . options . ajax ) { var request = getRequest . call ( this ) , url = getUrl . call ( this ) ; if ( url == null || typeof url !== "string" || url . length === 0 ) { throw new Error ( "Url setting must be a none empty string or a function that returns one." ) ; } // aborts the previous ajax request if not already finished or failed if ( this . xqr ) { this . xqr . abort ( ) ; } var settings = { url : <mask> , data : request , success : function ( response ) { that . xqr = null ; if ( typeof ( response ) === "string" ) { response = $ . parseJSON ( response ) ; } response = that . options . responseHandler ( response ) ; that . current = response . current ; update ( response . rows , response . total ) ; } , error : function ( jqXHR , textStatus , errorThrown ) { that . xqr = null ; if ( textStatus !== "abort" ) { renderNoResultsRow . call ( that ) ; // overrides loading mask that . element . _bgBusyAria ( false ) . trigger ( "loaded" + namespace ) ; } } } ; settings = $ . extend ( this . options . ajaxSettings , settings ) ; this . xqr = $ . ajax ( settings ) ; } else { var rows = ( this . searchPhrase . length > 0 ) ? this . rows . where ( containsPhrase ) : this . rows , total = rows . length ; if ( this . rowCount !== - 1 ) { rows = rows . page ( this . current , this . rowCount ) ; } // todo: improve the following comment // setTimeout decouples the initialization so that adding event handlers happens before window . setTimeout ( function ( ) { update ( rows , total ) ; } , 10 ) ; } }