Database Editor Issue
Database Editor Issue
Hi all, I have some issues with a table.
I'm allowing users to get data from mysql database, I have inline action link EDIT and DELETE like the example and all it's working fine,
now I'm adding a new link to redirect user to a specific php page for that raw, so I have add editor_go
$('#mytab').on('click', 'a.editor_go', function (e) {
e.preventDefault();
var nRow=$(this).parents('tr')[0];
var aData = oTable.fnGetData(nRow);
alert(aData[2]); <- this aData[N] told me "undefined"
here I have to redirect user to a new page "advanced_editor.php?cid="+cid <- value from the hidden CID field from the database
but I'm not able to access that value of that specific td
} );
this is rest of my code
oTable = $('#mytab').dataTable( {
"bProcessing": true,
"bPaginate": true,
"bInfo": true,
"bLengthChange": true,
"sPaginationType": "full_numbers",
"sDom": "Tfrtip",
"sAjaxSource": "db_adm.php",
"aoColumns": [
{ "mDataProp": "cname" },
{ "mDataProp": "cdescription" },
{ "mDataProp": "ISO2", "bSearchable": false },
{ "mDataProp": "begindate", "sClass": "center", "bSearchable": false },
{ "mDataProp": "enddate", "sClass": "center", "bSearchable": false },
{ "mDataProp": "cid", "bSearchable": false ,"bVisible": false},
{ "mDataProp": null,
"sClass": "center",
"bSearchable": false ,
"bSortable": false,
"sDefaultContent": '
' }
]
} );
} );
Thanks a lot Alex
I'm allowing users to get data from mysql database, I have inline action link EDIT and DELETE like the example and all it's working fine,
now I'm adding a new link to redirect user to a specific php page for that raw, so I have add editor_go
$('#mytab').on('click', 'a.editor_go', function (e) {
e.preventDefault();
var nRow=$(this).parents('tr')[0];
var aData = oTable.fnGetData(nRow);
alert(aData[2]); <- this aData[N] told me "undefined"
here I have to redirect user to a new page "advanced_editor.php?cid="+cid <- value from the hidden CID field from the database
but I'm not able to access that value of that specific td
} );
this is rest of my code
oTable = $('#mytab').dataTable( {
"bProcessing": true,
"bPaginate": true,
"bInfo": true,
"bLengthChange": true,
"sPaginationType": "full_numbers",
"sDom": "Tfrtip",
"sAjaxSource": "db_adm.php",
"aoColumns": [
{ "mDataProp": "cname" },
{ "mDataProp": "cdescription" },
{ "mDataProp": "ISO2", "bSearchable": false },
{ "mDataProp": "begindate", "sClass": "center", "bSearchable": false },
{ "mDataProp": "enddate", "sClass": "center", "bSearchable": false },
{ "mDataProp": "cid", "bSearchable": false ,"bVisible": false},
{ "mDataProp": null,
"sClass": "center",
"bSearchable": false ,
"bSortable": false,
"sDefaultContent": '
' }
]
} );
} );
Thanks a lot Alex
This discussion has been closed.
Replies
"aoColumns": [
{ "mDataProp": "cname" },
{ "mDataProp": "cdescription" },
{ "mDataProp": "ISO2", "bSearchable": false },
{ "mDataProp": "begindate", "sClass": "center", "bSearchable": false }, { "mDataProp": "enddate", "sClass": "center", "bSearchable": false }, { "mDataProp": "cid", "bSearchable": false ,"bVisible": false},
{
"mDataProp": "cid",
"sClass": "center",
"bSearchable": false ,
"bSortable": false,"fnRender": function ( o, val ) {
return ' ' } }
]
} );
} );
function opensit(val) {
window.open ('YourNewPage.php?cid='+val,'_self',false)
return false;
}
Thx anyway.
maybe the two mDataProp : "cid" introduce something wrong because on edit I got
An SQL error occurred: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '0' for key 'PRIMARY'
Allan
but my main issue is this :
$('#mytab').on('click', 'a.editor_go', function (e) {
e.preventDefault();
var nRow=$(this).parents('tr')[0];
var aData = oTable.fnGetData(nRow);
alert(aData[2]); <- this aData[N] told me "undefined"
here I have to redirect user to a new page "advanced_editor.php?cid="+cid <- value from the hidden CID field from the database
but I'm not able to access that value of that specific td
} );
Allan
DT_RowId: "row_35"
ISO2: "it"
begindate: "01-05-2012"
cdescription: "man"
cid: "35"
cname: "mandingo"
enddate: "23-05-2012"
owner: "24"
best regards Alex