Responsive 2, Input Field

Responsive 2, Input Field

btreebtree Posts: 99Questions: 14Answers: 11
edited November 2015 in Free community support

Hi,

I use a Check Input field in my table. I also use ServerSide Data, with following code I set the prop checked or let it unchecked.

rowCallback: function (row, data, index){
        console.log(row);
        //Active/Inactive Checkbox in Table
        $('input.editor-active', row).prop( 'checked', data.hive.modus == 1 );

I now installed the new responsive 2, there is a nice listener but I don't know whats the best way to get the field.

Dtable.on( 'responsive-display', function ( e, datatable, row, showHide, update ) {
    $('input.editor-active', ???).prop('checked');  //Search Data and check the Field if needed
} );

Secondly, I would need to change the Click Event. Here I save the change to the DB with Editor.

//Function to save Modus change on table checkbox click
$('#'+kind+'_table').on( 'change', 'input.editor-active', function () {
    editor.edit( $(this).closest('tr'), false );  //Change this Element
    editor.set( 'hive.modus', $(this).prop( 'checked' ) ? 1 : 0 );
    editor.submit();
} );

Anyone already using Responsive and an aktive Input field?

Cheers
Hannes

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,791Questions: 1Answers: 10,513 Site admin
    Answer ✓

    The problem with input elements with Responsive is that Responsive will insert a clone of the element into the child row - not the original. Using the original proved to add some considerable complexity that I haven't yet worked through.

    There is, currently, basically no way to use input elements with Responsive.

    Allan

  • btreebtree Posts: 99Questions: 14Answers: 11

    Hi Allan,

    thanks for the quick response.

    No problem then I simple use the className: all for this field and stop it from getting into the responsive layout at all.

    Cheers
    Hannes

  • rebzrebz Posts: 1Questions: 0Answers: 0

    Found a jsfiddle of someone using inputs/selects within a responsive datatable.
    https://jsfiddle.net/gyrocode/phLtk2mh/

This discussion has been closed.