How to disable / enable jeditable on the fly
How to disable / enable jeditable on the fly
Hi *,
first of all I like to say: Thank You Allan!
Datatables is great stuff.... :)
I use Datatables to build a nice LDAP editor. My LDAP directory has about 4000 objects and I display many attributes through Datatables. I also make the entries editable with the jeditable plugin. Problem is that if I have more then about 200 entries displayed at one Datatables page the browser can't execute the js code anymore. IE just get stucked, Firefox gives me an "unresponsive script" error.
I have found an workaround for this - I just deactivated the jeditable plugin and it loads without problems. Now I build a simple "edit on/off" form before loading the Datatables website. So I can load the website editable - works but not for more then 200 entries per page - or I load the website without the edit and that works to display all entries.
But if somebody now uses the website without the edit and search for an object - and now likes to edit this founded object he first have to switch to the Datatables website with the edit enabled and then have to search again because the Datatable is reload again...
Therefore my question: Is there any good solution to disable / enable jeditable on the fly? I like to search for an entry - if I found it, I like to edit it and therefore I just doubleclick the founded entry and the jeditable plugin is loaded for this entry only without the performance issues.
Maybe somebody have an idea... - see code below...
Thank you. Tobi
[code]
$(document).ready( function () {
$('#example').dataTable({
"bJQueryUI": false,
"sPaginationType": "full_numbers",
"bPaginate": true,
"aLengthMenu": [[25, 50, 100, 1000, 5000, 10000, -1], [25, 50, 100, 1000, 5000, 10000, "All"]],
"iDisplayStart": 0,
"iDisplayLength": 25,
"bSort": false,
"bProcessing": true,
"bServerSide": true,
"sScrollX": "100%",
"bScrollCollapse": true,
"sAjaxSource": "get_users.php",
"aoColumns":[
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{}
],
"sDom": 'T<"clear">lfrtip',
"oTableTools": {
"sSwfPath": "media/swf/copy_cvs_xls_pdf.swf"
},
"fnServerData": function ( sSource, aoData, fnCallback ) {
/* Add some extra data to the sender */
aoData.push( { "name": "o", "value": "<?php echo $_POST['o']; ?>" } );
aoData.push( { "name": "deleted", "value": "<?php echo $_POST['deleted']; ?>" } );
$.getJSON( sSource, aoData, function (json) {
fnCallback(json)
} );
},
"oLanguage": {
"sSearch": "Search all columns:"
}
})
<?php
if ($editable == "yes") {
echo <<< HERE
.makeEditable({
sUpdateURL: "update_user.php",
aoColumns: [
null,
null,
null,
{},
null,
{},
{},
{},
null,
{},
{},
null,
{},
{},
null,
{},
{},
{},
null,
{
indicator: 'preferredlanguage',
tooltip: 'preferredlanguage',
type: 'select',
onblur: 'submit',
data: "{'':'Please select...', 'en-US':'en-US','en-GB':'en-GB','fr':'fr', 'de':'de', 'es':'es', 'ja':'ja', 'it':'it', 'ko':'ko', 'zh-CN':'zh-CN', 'zh-TW':'zh-TW'}"
},
{},
null
]
});
HERE;
}
?>
});
[/code]
first of all I like to say: Thank You Allan!
Datatables is great stuff.... :)
I use Datatables to build a nice LDAP editor. My LDAP directory has about 4000 objects and I display many attributes through Datatables. I also make the entries editable with the jeditable plugin. Problem is that if I have more then about 200 entries displayed at one Datatables page the browser can't execute the js code anymore. IE just get stucked, Firefox gives me an "unresponsive script" error.
I have found an workaround for this - I just deactivated the jeditable plugin and it loads without problems. Now I build a simple "edit on/off" form before loading the Datatables website. So I can load the website editable - works but not for more then 200 entries per page - or I load the website without the edit and that works to display all entries.
But if somebody now uses the website without the edit and search for an object - and now likes to edit this founded object he first have to switch to the Datatables website with the edit enabled and then have to search again because the Datatable is reload again...
Therefore my question: Is there any good solution to disable / enable jeditable on the fly? I like to search for an entry - if I found it, I like to edit it and therefore I just doubleclick the founded entry and the jeditable plugin is loaded for this entry only without the performance issues.
Maybe somebody have an idea... - see code below...
Thank you. Tobi
[code]
$(document).ready( function () {
$('#example').dataTable({
"bJQueryUI": false,
"sPaginationType": "full_numbers",
"bPaginate": true,
"aLengthMenu": [[25, 50, 100, 1000, 5000, 10000, -1], [25, 50, 100, 1000, 5000, 10000, "All"]],
"iDisplayStart": 0,
"iDisplayLength": 25,
"bSort": false,
"bProcessing": true,
"bServerSide": true,
"sScrollX": "100%",
"bScrollCollapse": true,
"sAjaxSource": "get_users.php",
"aoColumns":[
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{}
],
"sDom": 'T<"clear">lfrtip',
"oTableTools": {
"sSwfPath": "media/swf/copy_cvs_xls_pdf.swf"
},
"fnServerData": function ( sSource, aoData, fnCallback ) {
/* Add some extra data to the sender */
aoData.push( { "name": "o", "value": "<?php echo $_POST['o']; ?>" } );
aoData.push( { "name": "deleted", "value": "<?php echo $_POST['deleted']; ?>" } );
$.getJSON( sSource, aoData, function (json) {
fnCallback(json)
} );
},
"oLanguage": {
"sSearch": "Search all columns:"
}
})
<?php
if ($editable == "yes") {
echo <<< HERE
.makeEditable({
sUpdateURL: "update_user.php",
aoColumns: [
null,
null,
null,
{},
null,
{},
{},
{},
null,
{},
{},
null,
{},
{},
null,
{},
{},
{},
null,
{
indicator: 'preferredlanguage',
tooltip: 'preferredlanguage',
type: 'select',
onblur: 'submit',
data: "{'':'Please select...', 'en-US':'en-US','en-GB':'en-GB','fr':'fr', 'de':'de', 'es':'es', 'ja':'ja', 'it':'it', 'ko':'ko', 'zh-CN':'zh-CN', 'zh-TW':'zh-TW'}"
},
{},
null
]
});
HERE;
}
?>
});
[/code]
This discussion has been closed.