jeditable setting settings.loadurl in the callback
jeditable setting settings.loadurl in the callback
I have a problem getting USER_ID to form the first url parameter of `editable`.
USER_ID is the first cell value, normally I extract it like this: `$(this).closest('tr').children().first().text()`
In `fnDrawCallback`, `this` has the whole table, but I can get this USER_ID in `callback` of `editable`.
Is it possible to set url in the callback? How do I refer to settings.loadurl of editable?
[code]
var oTable = $('#main_data_table').dataTable({
"bJQueryUI": true,
"bProcessing": true,
"bServerSide": true,
"bSort": true,
"sAjaxSource": getApiUrl("/users"),
"aoColumns": aoColumns,
"aoColumnDefs":[{
"aTargets": [1],
"bSortable": false,
"mRender": function ( val, type, full ) {
return '' + val + '';
}
},
{
"aTargets": [2],
"mRender": getEditIcon
}, {
"aTargets": [3],
"mRender": getEditIcon
}],
"fnDrawCallback": function( oSettings ) {
// On this stage, 'this' has the whole table so I can't get USER_ID
$('td .editable', oTable.fnGetNodes()).editable(getApiUrl("/user/@@I_NEED_USER_ID_HERE@@/user_ref"), {
"callback": function( sValue, y ) {
// Here I can get USER_ID
var USER_ID =getApiUrl("/user/" + getUserid(this) + "/user_ref");
},
"submitdata": function ( value, settings ) {
return {
// ... };
},
"height": "14px",
});
}
});
[/code]
USER_ID is the first cell value, normally I extract it like this: `$(this).closest('tr').children().first().text()`
In `fnDrawCallback`, `this` has the whole table, but I can get this USER_ID in `callback` of `editable`.
Is it possible to set url in the callback? How do I refer to settings.loadurl of editable?
[code]
var oTable = $('#main_data_table').dataTable({
"bJQueryUI": true,
"bProcessing": true,
"bServerSide": true,
"bSort": true,
"sAjaxSource": getApiUrl("/users"),
"aoColumns": aoColumns,
"aoColumnDefs":[{
"aTargets": [1],
"bSortable": false,
"mRender": function ( val, type, full ) {
return '' + val + '';
}
},
{
"aTargets": [2],
"mRender": getEditIcon
}, {
"aTargets": [3],
"mRender": getEditIcon
}],
"fnDrawCallback": function( oSettings ) {
// On this stage, 'this' has the whole table so I can't get USER_ID
$('td .editable', oTable.fnGetNodes()).editable(getApiUrl("/user/@@I_NEED_USER_ID_HERE@@/user_ref"), {
"callback": function( sValue, y ) {
// Here I can get USER_ID
var USER_ID =getApiUrl("/user/" + getUserid(this) + "/user_ref");
},
"submitdata": function ( value, settings ) {
return {
// ... };
},
"height": "14px",
});
}
});
[/code]
This discussion has been closed.