Edit, delete and what about VIEW ???

Edit, delete and what about VIEW ???

lifedaniellifedaniel Posts: 68Questions: 4Answers: 0

Hello, I have some tables that have like 20 columns, so I would like to know if it's possible to just show in the datatable 5-6 columns, and then have a "view" option like the edit or delete, that open a modal with the read only mode ? And just an exit button.

Thank you

Replies

  • ciroracirora Posts: 29Questions: 2Answers: 1

    Hi,
    there is https://datatables.net/extensions/colvis/
    Enable the view of your def columns, and through ColVis users can choose which columns view.

  • lifedaniellifedaniel Posts: 68Questions: 4Answers: 0

    That's not what I need, I need an option View right to the delete and edit that open a Modal with the informations and an exit button. Thank you anyway

  • lifedaniellifedaniel Posts: 68Questions: 4Answers: 0

    With editor (server side)

  • ciroracirora Posts: 29Questions: 2Answers: 1

    Maybe are you looking for this: https://datatables.net/examples/api/row_details.html

    Show your 5/6 columns and on the click systems shows extra info

  • xain819xain819 Posts: 15Questions: 4Answers: 1
    edited August 2014

    i would suggest if your going to use what cirora mention u could use
    http://editor.datatables.net/examples/simple/responsive.html
    so that even if you show 20+ column it would automatically generate a row details below that row..

    also if you really insist on wht you want u could just create a new var editor2; and
    do it like this:

    var editor2;
                    editor2 = new $.fn.dataTable.Editor({
                        "ajax": "includes/php/page.php",
                        "table": "#example",
                        fields: [{
                                "label": "EmployeeName:",
                                "name": "empid",
                                "type": "readonly"
                                ]
                            }, {
                                "label": "Colleges:",
                                "name": "collegeid",
                                "type": "readonly"
                            }]
                    });
    

    and for the button

    tableTools: {
                            sRowSelect: "os",
                            aButtons: [
                                {sButtonText: 'View', sExtends: "editor_edit", editor: editor2},
                            ]
                        },
    

    thou i don't now how to remove the update button in the editor :(

  • allanallan Posts: 63,262Questions: 1Answers: 10,424 Site admin

    There is an example available on the Editor site showing how to can have data shown in the form only: http://editor.datatables.net/examples/advanced/formOnlyData.html .

    Equally, you could also have data in the table only if you so wished!

    Allan

  • lifedaniellifedaniel Posts: 68Questions: 4Answers: 0

    The way xain819 did it looks pretty fine and that's what I kinda need. But I need to remove the "update bottom" and the bottom, and if possible, change the INPUT(read only) by just a text.

    Is it possible?

  • allanallan Posts: 63,262Questions: 1Answers: 10,424 Site admin

    Apologies - I misread your question before, so my reply probably wasn't too helpful before!

    But I need to remove the "update bottom" and the bottom

    Set the buttons() option to be an empty array, or perhaps have a Close button that calls close().

    change the INPUT(read only) by just a text.

    I think a field type plug-in would probably be the best option there. There is once that is already available for this: https://editor.datatables.net/plug-ins/field-type/editor.display .

    I should say that having a built in view option is on the to-do list for Editor.

    Allan

  • lifedaniellifedaniel Posts: 68Questions: 4Answers: 0

    DO you have an exemple to remove the update bottom and change the texts of the header for the editor2 ??

  • allanallan Posts: 63,262Questions: 1Answers: 10,424 Site admin

    I think you should be able to just call the buttons() function with an empty array - for example: editor.buttons( [] ). There are a number of examples of how to use it in the documentation.

    Allan

This discussion has been closed.