Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

Im having a problem using Fixed Columns plugin for Datatables.

When I try to freeze the right column and i have hidden columns in the datatable it wont show the rigth colum. When I dont have hidden columns in the datatable the fixed column is shown correctly.

One more thing im using server-side precessing.

Here is the code im trying to use.

        "sScrollX": "100%",
        "sScrollXInner": "130%",            
        "bScrollCollapse": true,
        "fnInitComplete": function () {
            var resultadosFC = new FixedColumns( resultados, {
                "iLeftColumns": 0,
                "iRightColumns": 1,
                "sHeightMatch" :"auto"
            } );
          },
        "sPaginationType": "full_numbers",
        "bStateSave": false,
        "iCookieDuration": 3600,
        "bJQueryUI": true,
        "bProcessing": true,
        "bServerSide": true,
        "sAjaxSource": "index.php?option=com_entidades&task=getSolicitudes",
        "aaSorting": [[0,'desc']],
        "bAutoWidth": false,
        "aoColumns": [
                      null,
                      {
                          "fnRender": function(oObj) {
                              if(oObj.aData[1]!=null)
                                  return moment(oObj.aData[1], "YYYY-MM-DD HH:mm:ss").format("DD/MM/YYYY hh:mm:ss a");
                              else
                                  return null;
                          }
                      },
                      {
                          "fnRender": function(oObj) {
                              if(oObj.aData[2]!=null)
                                  return moment(oObj.aData[2], "YYYY-MM-DD HH:mm:ss").format("DD/MM/YYYY hh:mm:ss a");
                              else
                                  return null;
                          }
                      },
                      {
                          "fnRender": function(oObj) {
                              if(oObj.aData[3]!=null)
                                  return moment(oObj.aData[3], "YYYY-MM-DD HH:mm:ss").format("DD/MM/YYYY hh:mm:ss a");
                              else
                                  return null;
                          }
                      },
                      null,
                      null,
                      null,
                      null,
//when i hide the columns the fixed column doesnt show
                          { "bVisible": false },
                          { "bVisible": false },
//this is the column i want to freeze
                          {
                                "bSortable": true, 
                                "bSearchable": false,
                                "sWidth" : "35px",
                                "fnRender": function(oObj) {
                                    var reg_completo = oObj.aData[8];
                                    if( reg_completo == 'I' ){ return '<div align="center"><label style="color:red">I</label></div>'; }
                                    else if( reg_completo == 'C'){ return '<div align="center"><label style="color:green">C</label></div>'; }
                                }
                          },
                          {
                              "bSortable": false, 
                              "bSearchable": false,
                              "fnRender": function(oObj) {
                                  var id = oObj.aData[0];
                                  var codEstadoSolicitud = oObj.aData[10];
                                  var regUserID = oObj.aData[11];
                                  var acciones="";
                                  if(canDoEditarCrearSolicitud && codEstadoSolicitud == constSolicitudBorrador && jSigeUserID == regUserID)
                                      acciones=acciones + linkEditar + linkEliminar + linkEnviar;
                                  else
                                      acciones=acciones + linkVer;
                                  return acciones.replace(/\$var/g,id);
                            }
                          }                      
                          ]
        });
share|improve this question
I've just found a workaround, set the col visibility after initialization. Any other suggestion? – arlievanos May 25 '12 at 19:04

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.