passed the column id to another page datatable

passed the column id to another page datatable

psYch022psYch022 Posts: 6Questions: 4Answers: 0

i want to make a column which has button
so when user press that button the extra data from sql is shown on another datatable

Answers

  • rf1234rf1234 Posts: 2,943Questions: 87Answers: 416

    this is how to create a button in a data table:
    https://datatables.net/examples/ajax/null_data_source

    In case you use Editor: on button click you can pass a value to a potential child table and then ajax reload it accordingly.
    Take a look at this blog for parent child editing:
    https://datatables.net/blog/2016-03-25

    This is particularly relevant for the child table. In "data" you pass the value from the parent table (your table with the button) to the server. In your child table Editor instance you can use it in the where clause for example.

    var usersEditor = new $.fn.dataTable.Editor( {
        ajax: {
            url: '../php/users.php',
            data: function ( d ) {
                var selected = siteTable.row( { selected: true } );
     
                if ( selected.any() ) {
                    d.site = selected.data().id;
                }
            }
        },
        table: '#users',
        fields: [ ... ]
    } );
    
This discussion has been closed.