Hide column in JTable JQuery

1

I use the Jquery JTable table, and I want to know how the column is hidden:

Table:

$('#miTabla').jtable({
    title : 'Datos Detalle',
    paging : true,
    pageSize : 10,
    pageList : 'minimal',
    saveUserPreferences : true,
    jqueryuiTheme: true,
    messages : {
        noDataAvailable: 'No hay datos disponibles!',
        addNewRecord: 'Añade detalle',
        editRecord: 'Edita detalle',
        save: 'Guardar'

    },
    actions : {
        listAction: 'listDetailAction'
    },
    fields : { 
        idDetalle : {
            title : "Id Detalle",
            key : true,
            list : false
        },
        detalle : {
            title : 'Concepto',
            width: '33%'

        },
        descripcion : {
            title : 'Descripción',
            width: '33%'
        }
    }
});

According to the official documentation : There is the changeColumnVisibility(columnName, visibility) method, but I do not know how it is used.

I have tried the following:

$('#miTabla').jtable('changeColumnVisibility',{detalle :'hidden'});

But it does not do anything, neither error nor any useful information.

Does anyone know what my mistake may be?

    
asked by nachfren 03.08.2017 в 14:59
source

2 answers

1

Do not do so

  

$ ('# myTable'). jtable ('changeColumnVisibility', {detail: 'hidden'});

Change to this $('#miTabla').jtable('changeColumnVisibility','detalle','hidden');

Documentation

link

    
answered by 03.08.2017 / 16:35
source
1

Try placing visibility in one of your fields, plus before fields you need a comma (, ) and all fields must be inside braces {}

$('#miTabla').jtable({
    title : 'Datos Detalle',
    paging : true,
    pageSize : 10,
    pageList : 'minimal',
    saveUserPreferences : true,
    jqueryuiTheme: true,
    messages : {
        noDataAvailable: 'No hay datos disponibles!',
        addNewRecord: 'Añade detalle',
        editRecord: 'Edita detalle',
        save: 'Guardar'

    },
    actions : {
        listAction: 'listDetailAction'
    }, //te falta esta coma
    fields : { //te falta esta llave
        idDetalle : {
            title : "Id Detalle",
            key : true,
            list : false
        },
        detalle : {
            title : 'Concepto',
            width: '33%'
            visibility: 'hidden' //propiedad para ocultar
        },
        descripcion : {
            title : 'Descripción',
            width: '33%'
        }
     }//te falta esta llave

});
    
answered by 03.08.2017 в 15:45