Wish List Item - No wait, BEGGING item!!!

Wish List Item - No wait, BEGGING item!!!

ruzzruzz Posts: 49Questions: 0Answers: 0
edited August 2010 in General
Allan - Please please PLEASE add Ajax error property for fnServerData handling. Thing is, you (your code) cannot possibly know what to do with all error conditions (some error conditions are in fact not errors - they're legitimate states).

You mentioned in another thread you might consider "abstracting this out" - or words to that effect. Mate, no offence, it's already there and dataTables is hiding it.

just my 0.02.
ruzz

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    I don't really understand - this is already in DataTables as far as I am aware. The default function used for fnServerData defines an error handler:

    [code]
    this.fnServerData = function ( url, data, callback ) {
    $.ajax( {
    "url": url,
    "data": data,
    "success": callback,
    "dataType": "json",
    "cache": false,
    "error": function () {
    alert( "DataTables warning: JSON data from server failed to load or be parsed. "+
    "This is most likely to be caused by a JSON formatting error." );
    }
    } );
    };
    [/code]
    If you override fnServerData with your own function, then you are free to had whatever error handler you want.

    Or am I missing something?

    Allan
  • ruzzruzz Posts: 49Questions: 0Answers: 0
    Hi Allan - confession: the confusion and misunderstanding is all mine

    I was having trouble figuring out how to dig into $.getJSON and had not realised (or then even seen) an example using $.ajax - my bad. RTFM and all that ;)

    But, FYI, I was referring to this thread: http://datatables.net/forums/comments.php?DiscussionID=1084

    ruzz
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    No problem. 1.5.x was the release series when that thread started up - and it indeed didn't have a default error handler. Always listening me ;-)

    Regards,
    Allan
This discussion has been closed.