Issue with data display
Issue with data display
CamilleriAlexandre
Posts: 2Questions: 0Answers: 0
Hi everyone, iam lurking around since 1 month and this is my cherrypopping.
I am actually on internship and i need some help, just started web dev 1 month ago.
So the probleme is that my data display in html and not in the "DataTables way", since i am newbie an example will be better:
here is the DataTable declaration (same for the tab1 and tab 2)
[code]
var tab2 = $('#tab2').dataTable({
"bJQueryUI": true,
"iDisplayLength": 25,
"oLanguage": oLanguage,
"sPaginationType": "full_numbers",
"fnDrawCallback": function() {
$('#tab2 tbody tr').draggable({
cursorAt: {left: 48 / 2, top: 48 / 2},
helper: function(event){
var td = $(event.target).closest('tr').children('td:first');
return $('' + $(td).next().text() + ' ' + $(td).next().next().text() + '');
}});
},
"fnRowCallback": function(nRow, aData) {
$(nRow).attr('id', aData[3]);
$(nRow).addClass('tab2');
$(nRow).children('td:first').click(function(){
$.ajax({'type': 'POST',
'url': 'user_from_to_rh.php',
'data': 'action=2&username=' + $(this).parent().attr('id') + '&ref=' + $('#select_ref').val(),
success: function(data){
oTable[0].fnDraw();
oTable[1].fnDraw();
}
});
}).attr('style', 'cursor: pointer;');
return nRow;
}
});
[/code]
and here are the functions who will fit the
[code]
function load_owned_list() {
var select_ref = $('#select_ref').val();
$.ajax({
type: "POST",
url: "load_owned_list.php",
data: {select_ref : select_ref}
}).done( function (data) {
console.log(data);
$('#tab1 tbody').html(data);
tab1.fnReloadAjax();
});
}
function load_available_list() {
var select_ref = $('#select_ref').val();
$.ajax({
type: "POST",
url: "load_available_list.php",
data: {select_ref : select_ref}
}).done( function (data) {
console.log(data);
$('#tab2 tbody').html(data);
tab2.fnReloadAjax();
});
}
[/code]
they gave a valid output.
So when i refresh/use the data it only display in plain html inside my datatable...
sorry i cant get a screenshoot right now :/
Tell me if you know something, and sorry for my poor english!
PS: congratz Allan!
I am actually on internship and i need some help, just started web dev 1 month ago.
So the probleme is that my data display in html and not in the "DataTables way", since i am newbie an example will be better:
here is the DataTable declaration (same for the tab1 and tab 2)
[code]
var tab2 = $('#tab2').dataTable({
"bJQueryUI": true,
"iDisplayLength": 25,
"oLanguage": oLanguage,
"sPaginationType": "full_numbers",
"fnDrawCallback": function() {
$('#tab2 tbody tr').draggable({
cursorAt: {left: 48 / 2, top: 48 / 2},
helper: function(event){
var td = $(event.target).closest('tr').children('td:first');
return $('' + $(td).next().text() + ' ' + $(td).next().next().text() + '');
}});
},
"fnRowCallback": function(nRow, aData) {
$(nRow).attr('id', aData[3]);
$(nRow).addClass('tab2');
$(nRow).children('td:first').click(function(){
$.ajax({'type': 'POST',
'url': 'user_from_to_rh.php',
'data': 'action=2&username=' + $(this).parent().attr('id') + '&ref=' + $('#select_ref').val(),
success: function(data){
oTable[0].fnDraw();
oTable[1].fnDraw();
}
});
}).attr('style', 'cursor: pointer;');
return nRow;
}
});
[/code]
and here are the functions who will fit the
[code]
function load_owned_list() {
var select_ref = $('#select_ref').val();
$.ajax({
type: "POST",
url: "load_owned_list.php",
data: {select_ref : select_ref}
}).done( function (data) {
console.log(data);
$('#tab1 tbody').html(data);
tab1.fnReloadAjax();
});
}
function load_available_list() {
var select_ref = $('#select_ref').val();
$.ajax({
type: "POST",
url: "load_available_list.php",
data: {select_ref : select_ref}
}).done( function (data) {
console.log(data);
$('#tab2 tbody').html(data);
tab2.fnReloadAjax();
});
}
[/code]
they gave a valid output.
So when i refresh/use the data it only display in plain html inside my datatable...
sorry i cant get a screenshoot right now :/
Tell me if you know something, and sorry for my poor english!
PS: congratz Allan!
This discussion has been closed.
Replies