ajax and jQueryUI

ajax and jQueryUI

orangeorange Posts: 20Questions: 0Answers: 0
edited February 2010 in General
Hi all,

On my local environment, I can get the jQuery UI working with the included example but this doesn't work:
[code]

$(document).ready(function() {
$.getJSON( 'json.txt', null, function(json) {
$('#example').dataTable( json, {
"bJQueryUI": true,
"sPaginationType": "full_numbers"
});
});
});

[/code]

The table displays, sorts, and paginates the data wonderfully; it just won't accept the parameters.

Neither "bJQueryUI" or "sPaginationType" work so I'm thinking that none of the parameters will work. Is there a better way to write this?


thank you.

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    There is no second argument that can be passed to DataTables - which is why this doesn't work. There is only one argument which is recognised in the dataTable() function.

    Possibly this thread might be of interest to you: http://datatables.net/forums/comments.php?DiscussionID=1314

    Allan
  • orangeorange Posts: 20Questions: 0Answers: 0
    edited February 2010
    Thanks Allan.

    Is there a way to enable jqueryui to the above example in a different (correct) way? I don't think I have that part in the right place in the code.

    I know I'm missing something fundamental here but I can't seem to find an example that spells it out for me.

    Thank you so much for your time.

    (The reference to the other post was how I got it working; now, I just need to pass jqueryui the table.)
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    I assume you have a 2D data array available in the json reply?

    [code]

    $(document).ready(function() {
    $.getJSON( 'json.txt', null, function(json) {
    $('#example').dataTable( {
    "bJQueryUI": true,
    "sPaginationType": "full_numbers"
    "aaData": json.aaData
    });
    });
    });

    [/code]
    Or something like that...

    Allan
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    If you are doing that, then you could just use sAjaxSource: http://datatables.net/examples/data_sources/ajax.html . Depends if you want to do any extra processing on the JSON return.

    Allan
  • orangeorange Posts: 20Questions: 0Answers: 0
    Thanks Allan.

    I happily donated to this great product and community.
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Hi orange,

    Awesome - thanks very much :-)

    Allan
This discussion has been closed.