Bug in 1.3 beta 3
Bug in 1.3 beta 3
theg33k
Posts: 6Questions: 0Answers: 0
Dunno if this is supposed to be under 1.8 or "bugs" but here goes...
With 1.8 beta 2 I was able to do something like the following
Here's my table definition
[code]
$('#merchantTableContainer').dataTable( {
'bPaginate': false,
'sScrollY': '150px',
'bFilter': false,
'sPaginationType': 'full_numbers',
'bInfo': false,
'bLengthChange': false,
'bSort': false,
'bAutoWidth': true,
'sAjaxSource': '/pos/rest/merchants/dataTable',
'bProcessing': true,
'bServerSide': true,
'aoColumns' : [{'mDataProp': 'id',
'bSearchable': false,
'bVisible': false},
{'mDataProp': 'displayName'},
{'mDataProp': 'clientId'}
]
} );
jQuery.fn.dataTableExt.oPagination.iFullNumbersShowPages = 0;
[/code]
Making my table selectable
[code]
$('#merchantTableContainer tbody').click(function(event) {
$(oTable.fnSettings().aoData).each(function (){
$(this.nTr).removeClass('row_selected');
}
);
/* THIS IS THE PART THAT'S MOST IMPORTANT FOR THIS BUG REPORT */
var selectedRow = $(event.target.parentNode);
selectedRow.addClass('row_selected');
loadMerchant(oTable.fnGetData(event.target.parentNode)[0]);
});
[/code]
loadMerchant method (not all that important)
[code]
function loadMerchant(id)
{
$.ajax({
type: 'GET',
url: '/pos/rest/merchants/'+id,
contentType: 'text/html',
success: function(data, textStatus) {
$('#merchantForm').populate(data);
},
error: function ( XMLHttpRequest, textStatus, errorThrown){
alert('error'+textStatus+'\t'+errorThrown);
}
});
$('#add').attr('disabled', 'disabled');
$('#save').removeAttr('disabled');
}
[/code]
Anyways, "id" is now undefined. With 1.8 beta 2 this script was working fine. with 1.8 beta 3 it now shows the id variable as undefined.
With 1.8 beta 2 I was able to do something like the following
Here's my table definition
[code]
$('#merchantTableContainer').dataTable( {
'bPaginate': false,
'sScrollY': '150px',
'bFilter': false,
'sPaginationType': 'full_numbers',
'bInfo': false,
'bLengthChange': false,
'bSort': false,
'bAutoWidth': true,
'sAjaxSource': '/pos/rest/merchants/dataTable',
'bProcessing': true,
'bServerSide': true,
'aoColumns' : [{'mDataProp': 'id',
'bSearchable': false,
'bVisible': false},
{'mDataProp': 'displayName'},
{'mDataProp': 'clientId'}
]
} );
jQuery.fn.dataTableExt.oPagination.iFullNumbersShowPages = 0;
[/code]
Making my table selectable
[code]
$('#merchantTableContainer tbody').click(function(event) {
$(oTable.fnSettings().aoData).each(function (){
$(this.nTr).removeClass('row_selected');
}
);
/* THIS IS THE PART THAT'S MOST IMPORTANT FOR THIS BUG REPORT */
var selectedRow = $(event.target.parentNode);
selectedRow.addClass('row_selected');
loadMerchant(oTable.fnGetData(event.target.parentNode)[0]);
});
[/code]
loadMerchant method (not all that important)
[code]
function loadMerchant(id)
{
$.ajax({
type: 'GET',
url: '/pos/rest/merchants/'+id,
contentType: 'text/html',
success: function(data, textStatus) {
$('#merchantForm').populate(data);
},
error: function ( XMLHttpRequest, textStatus, errorThrown){
alert('error'+textStatus+'\t'+errorThrown);
}
});
$('#add').attr('disabled', 'disabled');
$('#save').removeAttr('disabled');
}
[/code]
Anyways, "id" is now undefined. With 1.8 beta 2 this script was working fine. with 1.8 beta 3 it now shows the id variable as undefined.
This discussion has been closed.
Replies
So in this case you could do:
[code]
oTable.fnGetData(event.target.parentNode).id
[/code]
which should do the trick nicely.
Allan