Quantcast
Channel: DataTables 1.9 — DataTables forums
Viewing all articles
Browse latest Browse all 1816

can't get data from row

$
0
0
When I click on a row - I add class info to it.
$("#roletable tbody").click(function(event) {
    	$(oTable2.fnSettings().aoData).each(function() {
    		$(this.nTr).removeClass('info');
    	});
    	$(event.target.parentNode).addClass('info');
    });

I want to pass values from selected row(it is always only one row) to modal form when I click on
rolesedit
button.
I was trying to do like this(I check each row and in order to check data I show alert)
$("#rolesedit").click(function() {
    	var arr = oTable1.fnGetNodes();
        var item = null;
        for(var i = 0; i < arr.length; i++) {
        	if ($(arr[i]).hasClass('info')){
        		item = oTable1.fnGetData(arr[i]);
        		alert(item[0]);
        	}
        }
        $('#ErolenameInput').val(item[0]);
        $('#ERoleID').val(item[1]);
    });
But item[0] is always undefined.
I was trying something like this too
$(oTable1.fnSettings().aoData).each(function() {
    		if ($(this.nTr).hasClass('info'))
    			alert('has class' + oTable1.fnGetData(this.nTr)[0]);
    	});
but it undefined too.

What is the correct way to get data?

Viewing all articles
Browse latest Browse all 1816

Trending Articles