row("selector").data() give a jQuery error

row("selector").data() give a jQuery error

AluminumCatAluminumCat Posts: 23Questions: 0Answers: 0
edited May 2014 in DataTables 1.10

I'm not sure what I'm doing wrong here.. But i'm trying to follow this example:
http://datatables.net/examples/api/select_row.html
In the example it seems to work fine, but when I do it, it gives me jQuery error:

TypeError: elem is null
return elem.nodeType === 1;
jquery.js (line 2662)

Here is my initialization function(I initialize 3 tables on the same page):

    function initialize_tables( element, type){

    return $( '#' + element ).DataTable( {
        "sAjaxSource":base_url+'connections/ajax_tables/'+type,
        "fnInitComplete": function(oSettings, json) {
                 make_click_n_redirect( '#' + element,'td');
                      prepend_Ajax_classes();

        },
        
        "bSortClasses": false,
        "asStripeClasses": [ '' ],        
        "sScrollY": "600px",
        "bDeferRender": true,        
        "sDom":
            "<'functions'<'small-12 columns dt_h'f>r>"+
            "<'toolbar'>"+
            "t"+
            "<'row'<'small-4 columns'i><'small-4 columns'>S>",

        "oLanguage": {
            "sSearch": ""
        },

        "fnDrawCallback": function( oSettings ) {
            prepend_Ajax_classes();
            
            if(window.id_selected === true){
                $('tr:not(.pseuoplus)').addClass('pseudoplus');
            }                 
        }
    });
    
    make_table_toolbar();
    } 

then I call them like this:
var uTable = initialize_tables( 'userTable', 'users' );

So what am I doing wrong? :(

Update: oh stupid me, I forgot to post the code that gives me trouble:

    $('div').on('click', function() {
        var jData = uTable.rows(".samecolor").data();
        console.log('data below:');
        console.log(jData);
    });

Replies

  • AluminumCatAluminumCat Posts: 23Questions: 0Answers: 0

    oh damn... im sorry... i seem to have screwed up linebreaks.
    how do I paste the code without it going on one line?

  • AluminumCatAluminumCat Posts: 23Questions: 0Answers: 0

    I figured it out ^^ forgot to put in $('') instead of just ''.

This discussion has been closed.