DataTables 1.10.8 - Buttons 1.0.0 - ColVis

DataTables 1.10.8 - Buttons 1.0.0 - ColVis

AtampizMiguelAtampizMiguel Posts: 5Questions: 1Answers: 0

Hi,
how i can set a Callback in Colvis? i created a custom colvis for this function but i dont like this.
I can set a callback when after render colvis? or before?
Tnx and sorry for my bad english.

Replies

  • renziitorenziito Posts: 1Questions: 0Answers: 0

    maybe just use somethign like the draw() function

  • allanallan Posts: 63,414Questions: 1Answers: 10,454 Site admin

    Just listen for the column-visibility event.

    Allan

  • AtampizMiguelAtampizMiguel Posts: 5Questions: 1Answers: 0

    Ok, and when i press button excel example? when its proccess in build excel?

  • allanallan Posts: 63,414Questions: 1Answers: 10,454 Site admin

    There is no callback or event for that. If you want that functionality you would need to define your own action for the button or attach your own event listener to it.

    Allan

  • warmnet2001warmnet2001 Posts: 6Questions: 0Answers: 0

    I'm trying datatables Editor 1.5, with 1.01 Buttons and Select 1.0.1. I need to modify the fields when exporting to .txt, but I can not do it fnCellRender. I'm not using TableTools because it was replaced by Buttons and Select. This is my code:

    buttons: [
    { extend: "create", editor: editor },
    { extend: "edit", editor: editor },
    { extend: "remove", editor: editor },
    { extend: "colvis", collectionLayout: "fixed two-column"},
    { extend: 'csv', fieldSeparator: "", extension: '.txt', header: false, text: 'Exportar',
    fnCellRender: function ( sValue, iColumn) {
    if ( iColumn === 1 ) {
    return sValue +" TableTools";
    }
    return sValue;
    },
    exportOptions: {
    columns: [0,1,2 ]
    }}
    ]

    I exported good, but does not change my spine.
    Appreciate give me a help, I can not fix it.
    Excuse my English, I use a translator.
    Best regards

  • allanallan Posts: 63,414Questions: 1Answers: 10,454 Site admin

    If you want to custom format the text for the exported data, you need to use the orthogonal option of the buttons.exportData() method (which you can set using the exportOptions option for the button you are working with (e.g. excelHtml5).

    That uses DataTables' orthogonal data abilities - so you would need to define a columns.render option for the column you want to customise the data export for, and give it a function that will handle the orthogonal data you want to export.

    Allan

  • AtampizMiguelAtampizMiguel Posts: 5Questions: 1Answers: 0

    Allan, tnx for your help, but, i need a "loading image" when the user press any button, example ,print view, export excel, etc.
    Any idea?

  • allanallan Posts: 63,414Questions: 1Answers: 10,454 Site admin

    You'd need to add a custom event handler to the button or modify the library.

    Allan

  • warmnet2001warmnet2001 Posts: 6Questions: 0Answers: 0
    edited August 2015

    Thanks Allan, but I still can not change the format, you would not have a small example, I'm testing within exportOtions and not working.
    Best regards

  • allanallan Posts: 63,414Questions: 1Answers: 10,454 Site admin

    I'll put an example together, but it will probably be a few weeks before I can do so due to other commitments.

    Allan

  • warmnet2001warmnet2001 Posts: 6Questions: 0Answers: 0

    I can not fix it. Because no test. This is what I have:
    {Extend 'csv' fieldSeparator "" extension '.txt' header: false, text: 'Export'
    ExportOptions: {
    columns: '3: visIdx'
    render: function (data, type, row) {
    return data + '1234';
    }
    }
    }

    It can be so hard?
    Best regards

  • allanallan Posts: 63,414Questions: 1Answers: 10,454 Site admin

    Please do not cross post - it just means less time for me to create such examples that you are looking for. I haven't had a chance to create an example yet - I will try to do so as soon as I can, but there is a massive support backlog at the moment.

    Allan

This discussion has been closed.