Autofill drawType

Autofill drawType

karliekarlie Posts: 83Questions: 17Answers: 0

Is there any way to stop the page from scrolling back to the top after I have used AutoFill? If I copy a value down into the cell below the page then scrolls back to the top. I've tried finding details about setting the drawType to none but I must be missing something. I'm using serverSide with Editor. My code looks like this:

var table = $('#stones').DataTable( {
        select: {
            style:    'os',
            selector: 'td:first-child'
        },
        autoFill: {
            editor:  editor
        },
        order: [[ 2, 'desc' ]],
        stateSave: true,
        colReorder: true,
        lengthMenu: [ [10, 25, 50, 200, 500, 1000, 5000], [10, 25, 50, 200, 500, 1000, 5000] ],
        scrollX: true,
        scrollY: '70vh',
        lengthChange: false,
        paging: true,
        pageLength: 500,
        ajax: {
            url: 'php/table.stones.php',
            type: "POST"
        },
        serverSide: true,
        columnDefs: [
        { orderable: false, targets: [8,9,10,11,12,13,14,15,16]},
        { visible: false, targets: [14,15,16,18]},
        {
        targets: 8,
        render: function ( data, type, row ) {
    return type === 'display' && data.length > 25 ?
        data.substr( 0, 25 ) +'…' :
        data;
        }}
        ],
        columns: [
            {
                data: null,
                defaultContent: '',
                className: 'select-checkbox',
                orderable: false
            },
            {
                "data": "web"
            },
            {
                "data": "sold_out"
            },
            {
                "data": "sku"
            },
            {
                "data": "type"
            },
            {
                "data": "category"
            },
            {
                "data": "material"
            },
            {
                "data": "shape"
            },
            {
                "data": "size"
            },
            {
                "data": "name"
            },
            {
                "data": "each_price"
            },
            {
                "data": "ten"
            },
            {
                "data": "fifty"
            },
            {
                "data": "ppct"
            },
            {
                "data": "av_weight"
            },
            {
                "data": "gram_price"
            },
            {
                "data": "datafile_desc"
            },
            {
                "data": "extra_info"
            },
            {
                "data": "modified"
            },
            {
                "data": "created"
            }
        ]
    } );

    new $.fn.dataTable.Buttons( table, [
        { extend: "create", editor: editor },
        { extend: "edit",   editor: editor },
        { extend: "remove", editor: editor },
        {
                extend: "selected",
                text: 'Duplicate',
                action: function ( e, dt, node, config ) {
                    // Start in edit mode, and then change to create
                    editor
                        .edit( table.rows( {selected: true} ).indexes(), {
                            title: 'Duplicate record',
                            buttons: 'Create from existing'
                        } )
                        .mode( 'create' );
                }
            },
            { extend: "remove", editor: editor },
        'copy', 'excelHtml5', 'csvHtml5', 'colvis'
    ] );
        table.buttons().container()
        .appendTo( $('.col-md-6:eq(0)', table.table().container() ) );
} );
    
}(jQuery));

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 62,602Questions: 1Answers: 10,291 Site admin

    Can you show me an example of AutoFill scrolling back to the top please? I've not been able to reproduce that in this example (or any of the others).

    Thanks,
    Allan

  • karliekarlie Posts: 83Questions: 17Answers: 0

    Here is a link so you can see. I think it may be connected to scrollY being enabled http://stuartday.co.uk/dtgem/stones.html

  • allanallan Posts: 62,602Questions: 1Answers: 10,291 Site admin
    Answer ✓

    Could you try adding:

    formOptions: {
      bubble: {
        drawType: 'none'
      }
    }
    

    into your Editor configuration object. That should stop it redrawing like that until I figure out a better way.

    Thanks,
    Allan

  • karliekarlie Posts: 83Questions: 17Answers: 0

    Smashing that did the trick thanks.

This discussion has been closed.