SOLVED bVisible : false doesn't work

SOLVED bVisible : false doesn't work

kostaspkostasp Posts: 8Questions: 0Answers: 0
edited November 2011 in General
Hello there,

I have problem hiding the first column. The datatable I use has 5 columns. I want the 1st column to be hidden, the 2o to be editable with datepicker, the 3rd to be editable with select and the last two columns to be editable with text. The example http://jquery-datatables-editable.googlecode.com/svn/trunk/server_side_processing.html says : "If you set aoColumns definitions in dataTable and editable number of columns should not match. In the dataTable plugin number of aoColumns elements should be same as the number of columns in the table. However, in the dataTables editable plugin number of aoColumns is equal to the number of visible columns. If you have five columns in the dataTable and first one is not visible, in the dataTables editable aoColumns array you will have four elements because each of the elements is applied to the visible cells." I did this but doesn't work

my code is this :
[code]
$(document).ready(function() {
oTable = $('#example').dataTable({
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "index.php?m=public&a=datatableserver&onlymain=true",
"fnServerParams": function ( aoData ) {
aoData.push( { "name": "db_table", "value": "transaction" } );
aoData.push( { "name": "db_table_id", "value": "tran_id" } );
aoData.push( { "name": "db_column_0", "value": "tran_id" } );
aoData.push( { "name": "db_column_1", "value": "tran_date" } );
aoData.push( { "name": "db_column_2", "value": "tran_cat_descr" } );
aoData.push( { "name": "db_column_3", "value": "tran_descr" } );
aoData.push( { "name": "db_column_4", "value": "tran_value" } );
},
"bPaginate": true,
"bLengthChange": true,
"bFilter": true,
"bSort": true,
"bSortClasses": true,
"bInfo": true,
"bAutoWidth": true,
"aaSorting": [[ 1, "desc" ]],
"bStateSave": true,
iCookieDuration : 60*60*24, /* 1 day */
"sPaginationType": "full_numbers",
"oLanguage": {
"oPaginate" :{
"sFirst" : "Πρώτη",
"sLast" : "Τελευτ.",
"sNext" : "Επόμ.",
"sPrevious" : "Προηγ."
},
"sEmpltyTable" : "Δεν υπάρχουν εγγαφές για εμφάνιση",
"sInfo": "Εμφανίζονται η _START_η μέχρι και η _END_η εγγραφή από σύνολο _TOTAL_",
"sLengthMenu": "Εμφάνισε _MENU_ εγγραφές ανά σελίδα",
"sLoadingRecords" : "Παρακάλω περιμένετε...φόρτωση εγγραφών",
"sProcessing" : "Επεξεργασία...",
"sZeroRecords": "Δεν υπάρχουν εγγαφές για εμφάνιση"
},
"bJQueryUI": true,
"sDom": '<"H"lr>t<"F"ip>',
"aoColumns": [
{
"bVisible" : false,
},
{
"sWidth" : "10%",
"sName" : "tran_date"
},
{
"sWidth" : "13%",
"sName" : "tran_cat_id"
},
{
"sName" : "tran_descr"
},
{
"sWidth" : "10%",
"sName" : "tran_value"
}
]
}).makeEditable({
sUpdateURL: "index.php?m=public&a=updatedata&onlymain=true",
"aoColumns": [
{
toolTip: 'Διπλό κλικ για διόρθωση',
cssclass: 'datepicker',
onblur: 'ignore',
},
{
type: 'select',
tooltip: 'Διπλό κλικ για διόρθωση',
loadtext: 'Φόρτωση...',
onblur: 'submit',
data: <?php echo $tran_categories; ?>,
style : 'inherit',
},
{
type: 'text',
toolTip: 'Διπλό κλικ για διόρθωση',
onblur: 'submit',
},
{
toolTip: 'Διπλό κλικ για διόρθωση',
onblur: 'submit',
},
]

});

$("#example tbody").on("focusin click", ".datepicker", function(event) {
var options = {
dateFormat: "yy-mm-dd",
changeMonth: true,
autoSize: true,
showOtherMonths: true,
selectOtherMonths: false,
showButtonPanel: true,
duration: 'fast',
navigationAsDateFormat:true,
showWeek: true,
changeYear: true,
onSelect: function(dateText, event) {
$(this).trigger('submit');
}
};

$("input").datepicker(options);

});

} );
[/code]

What's wrong with my code?

Replies

  • kostaspkostasp Posts: 8Questions: 0Answers: 0
    I did the same with "aoColumnDefs" but again the first column is not hidden

    [code]
    $(document).ready(function() {
    oTable = $('#example').dataTable({
    "bProcessing": true,
    "bServerSide": true,
    "sAjaxSource": "index.php?m=public&a=datatableserver&onlymain=true",
    "fnServerParams": function ( aoData ) {
    aoData.push( { "name": "db_table", "value": "transaction" } );
    aoData.push( { "name": "db_table_id", "value": "tran_id" } );
    aoData.push( { "name": "db_column_0", "value": "tran_id" } );
    aoData.push( { "name": "db_column_1", "value": "tran_date" } );
    aoData.push( { "name": "db_column_2", "value": "tran_cat_descr" } );
    aoData.push( { "name": "db_column_3", "value": "tran_descr" } );
    aoData.push( { "name": "db_column_4", "value": "tran_value" } );
    },
    "bPaginate": true,
    "bLengthChange": true,
    "bFilter": true,
    "bSort": true,
    "bSortClasses": true,
    "bInfo": true,
    "bAutoWidth": true,
    "aaSorting": [[ 1, "desc" ]],
    "bStateSave": true,
    iCookieDuration : 60*60*24, /* 1 day */
    "sPaginationType": "full_numbers",
    "oLanguage": {
    "oPaginate" :{
    "sFirst" : "Πρώτη",
    "sLast" : "Τελευτ.",
    "sNext" : "Επόμ.",
    "sPrevious" : "Προηγ."
    },
    "sEmpltyTable" : "Δεν υπάρχουν εγγαφές για εμφάνιση",
    "sInfo": "Εμφανίζονται η _START_η μέχρι και η _END_η εγγραφή από σύνολο _TOTAL_",
    "sLengthMenu": "Εμφάνισε _MENU_ εγγραφές ανά σελίδα",
    "sLoadingRecords" : "Παρακάλω περιμένετε...φόρτωση εγγραφών",
    "sProcessing" : "Επεξεργασία...",
    "sZeroRecords": "Δεν υπάρχουν εγγαφές για εμφάνιση"
    },
    "bJQueryUI": true,
    "sDom": '<"H"lr>t<"F"ip>',
    "aoColumnDefs": [
    { "bVisible": false, "aTargets": [ 0 ] }
    ]
    }).makeEditable({
    sUpdateURL: "index.php?m=public&a=updatedata&onlymain=true",
    "aoColumns": [
    {
    toolTip: 'Διπλό κλικ για διόρθωση',
    cssclass: 'datepicker',
    onblur: 'ignore',
    },
    {
    type: 'select',
    tooltip: 'Διπλό κλικ για διόρθωση',
    loadtext: 'Φόρτωση...',
    onblur: 'submit',
    data: <?php echo $tran_categories; ?>,
    style : 'inherit',
    },
    {
    type: 'text',
    toolTip: 'Διπλό κλικ για διόρθωση',
    onblur: 'submit',
    },
    {
    toolTip: 'Διπλό κλικ για διόρθωση',
    onblur: 'submit',
    }
    ]

    });

    $("#example tbody").on("focusin click", ".datepicker", function(event) {
    var options = {
    dateFormat: "yy-mm-dd",
    changeMonth: true,
    autoSize: true,
    showOtherMonths: true,
    selectOtherMonths: false,
    showButtonPanel: true,
    duration: 'fast',
    navigationAsDateFormat:true,
    showWeek: true,
    changeYear: true,
    onSelect: function(dateText, event) {
    $(this).trigger('submit');
    }
    };

    $("input").datepicker(options);

    });

    } );
    [/code]
  • kostaspkostasp Posts: 8Questions: 0Answers: 0
    I fix the problem with this code
    [code]
    $(document).ready(function() {
    oTable = $('#example').dataTable({
    "bProcessing": true,
    "bServerSide": true,
    "sAjaxSource": "index.php?m=public&a=datatableserver&onlymain=true",
    "fnServerParams": function ( aoData ) {
    aoData.push( { "name": "db_table", "value": "transaction" } );
    aoData.push( { "name": "db_table_id", "value": "tran_id" } );
    aoData.push( { "name": "db_column_0", "value": "tran_id" } );
    aoData.push( { "name": "db_column_1", "value": "tran_date" } );
    aoData.push( { "name": "db_column_2", "value": "tran_cat_descr" } );
    aoData.push( { "name": "db_column_3", "value": "tran_descr" } );
    aoData.push( { "name": "db_column_4", "value": "tran_value" } );
    },
    "bPaginate": true,
    "bLengthChange": true,
    "bFilter": true,
    "bSort": true,
    "bSortClasses": true,
    "bInfo": true,
    "bAutoWidth": true,
    "aaSorting": [[ 1, "desc" ]],
    "bStateSave": true,
    iCookieDuration : 60*60*24, /* 1 day */
    "sPaginationType": "full_numbers",
    "oLanguage": {
    "oPaginate" :{
    "sFirst" : "Πρώτη",
    "sLast" : "Τελευτ.",
    "sNext" : "Επόμ.",
    "sPrevious" : "Προηγ."
    },
    "sEmpltyTable" : "Δεν υπάρχουν εγγαφές για εμφάνιση",
    "sInfo": "Εμφανίζονται η _START_η μέχρι και η _END_η εγγραφή από σύνολο _TOTAL_",
    "sLengthMenu": "Εμφάνισε _MENU_ εγγραφές ανά σελίδα",
    "sLoadingRecords" : "Παρακάλω περιμένετε...φόρτωση εγγραφών",
    "sProcessing" : "Επεξεργασία...",
    "sZeroRecords": "Δεν υπάρχουν εγγαφές για εμφάνιση"
    },
    "bJQueryUI": true,
    "sDom": '<"H"lr>t<"F"ip>',
    "aoColumns": [
    { "bVisible" : false },
    {
    "sWidth" : "10%",
    "sName": "tran_date"
    },
    {
    "sWidth" : "13%",
    "sName": "tran_cat_id"
    },
    { "sName": "tran_descr" },
    {
    "sWidth" : "10%",
    "sName": "tran_value"
    }
    ]
    }).makeEditable({
    sUpdateURL: "index.php?m=public&a=updatedata&onlymain=true",
    "aoColumns": [
    {
    toolTip: 'Διπλό κλικ για διόρθωση',
    cssclass: 'datepicker',
    onblur: 'ignore',
    },
    {
    type: 'select',
    tooltip: 'Διπλό κλικ για διόρθωση',
    loadtext: 'Φόρτωση...',
    onblur: 'submit',
    data: <?php echo $tran_categories; ?>,
    style : 'inherit',
    },
    {
    type: 'text',
    toolTip: 'Διπλό κλικ για διόρθωση',
    onblur: 'submit',
    },
    {
    toolTip: 'Διπλό κλικ για διόρθωση',
    onblur: 'submit',
    }
    ]

    });

    $("#example tbody").on("focusin click", ".datepicker", function(event) {
    var options = {
    dateFormat: "yy-mm-dd",
    changeMonth: true,
    autoSize: true,
    showOtherMonths: true,
    selectOtherMonths: false,
    showButtonPanel: true,
    duration: 'fast',
    navigationAsDateFormat:true,
    showWeek: true,
    changeYear: true,
    onSelect: function(dateText, event) {
    $(this).trigger('submit');
    }
    };

    $("input").datepicker(options);

    });

    } );
    [/code]
This discussion has been closed.